mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Merge pull request #1459 from mchangrh/no-html-error
catch all html in error messages
This commit is contained in:
@@ -28,7 +28,7 @@ async function wait<T>(condition: () => T | false, timeout = 5000, check = 100):
|
|||||||
* @returns {string} errorMessage
|
* @returns {string} errorMessage
|
||||||
*/
|
*/
|
||||||
function getErrorMessage(statusCode: number, responseText: string): string {
|
function getErrorMessage(statusCode: number, responseText: string): string {
|
||||||
const postFix = ((responseText && !responseText.includes(`cf-wrapper`)) ? "\n\n" + responseText : "");
|
const postFix = ((responseText && !(responseText.includes(`cf-wrapper`) || responseText.includes("<!DOCTYPE html>"))) ? "\n\n" + responseText : "");
|
||||||
// display response body for 4xx
|
// display response body for 4xx
|
||||||
if([400, 429, 409, 0].includes(statusCode)) {
|
if([400, 429, 409, 0].includes(statusCode)) {
|
||||||
return chrome.i18n.getMessage(statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + statusCode + postFix;
|
return chrome.i18n.getMessage(statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + statusCode + postFix;
|
||||||
|
|||||||
Reference in New Issue
Block a user