Added a special error case for Brave browser

Affects issues:
- Notifies of #1406 #1425
This commit is contained in:
Risto Lahtela 2020-05-05 10:05:42 +03:00
parent 45d95ad2f3
commit b7e1261597

View File

@ -24,7 +24,12 @@ function jsonRequest(address, callback) {
callback(null, "Request did not reach the server. (Server offline / Adblocker?)")
}
} catch (e) {
callback(null, e.message + " (See " + address + ")")
if (e.message.includes('Unexpected end of JSON input') && navigator.brave && navigator.brave.isBrave) {
navigator.brave.isBrave()
.then(confirm => callback(null, e.message + (confirm ? " (Possibly blocked by ad-block in Brave)" : '') + " (See " + address + ")"));
} else {
callback(null, e.message + " (See " + address + ")")
}
}
}
};