Merge pull request #1224 from mchangrh/5xx-no-cf

ignore body if cloudflare error found
This commit is contained in:
Ajay Ramachandran 2022-03-12 00:02:41 -05:00 committed by GitHub
commit b167cecdce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ async function wait<T>(condition: () => T | false, timeout = 5000, check = 100):
* @returns {string} errorMessage
*/
function getErrorMessage(statusCode: number, responseText: string): string {
const postFix = (responseText ? "\n\n" + responseText : "");
const postFix = ((responseText && !responseText.includes(`cf-wrapper`)) ? "\n\n" + responseText : "");
// display response body for 4xx
if([400, 429, 409, 0].includes(statusCode)) {
return chrome.i18n.getMessage(statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + statusCode + postFix;