Skip to content

Commit

Permalink
Fix: drop __ERROR__
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Oct 13, 2018
1 parent 838c21e commit 90aadfd
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions content/install-hook-userstyles.js
Expand Up @@ -203,25 +203,19 @@


function getResource(url, options) {
return new Promise(resolve => {
if (url.startsWith('#')) {
resolve(document.getElementById(url.slice(1)).textContent);
} else {
API.download(Object.assign({
url,
timeout: 60e3,
// USO can't handle POST requests for style json
body: null,
}, options)).then(result => {
const error = result && result.__ERROR__;
if (error) {
alert('Error' + (error ? '\n' + error : ''));
} else {
resolve(result);
}
});
}
});
if (url.startsWith('#')) {
return Promise.resolve(document.getElementById(url.slice(1)).textContent);
}
return API.download(Object.assign({
url,
timeout: 60e3,
// USO can't handle POST requests for style json
body: null,
}, options))
.catch(error => {
alert('Error' + (error ? '\n' + error : ''));
throw error;
});
}


Expand Down

0 comments on commit 90aadfd

Please sign in to comment.