improve filters error handling
This commit is contained in:
parent
1ce691bec6
commit
cd788b8e32
1 changed files with 106 additions and 117 deletions
|
@ -108,30 +108,19 @@ export default class filters {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create promise of downloading.
|
// Create promise of downloading.
|
||||||
let filter_download = net.download(filter_URL, `JSON`);
|
let filter_download = net.download(filter_URL, `JSON`, false, true);
|
||||||
filter_download
|
filter_download
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
// Only work when the filter is valid.
|
// Only work when the filter is valid.
|
||||||
if (result) {
|
if (result) {
|
||||||
// Write the filter to storage.
|
// Write the filter to storage.
|
||||||
secretariat.write(["filters", filter_URL], result, -1);
|
secretariat.write(["filters", filter_URL], result, -1);
|
||||||
alerts.log(
|
alerts.log(texts.localized(`settings_filters_update_status_complete`,null,[filter_URL]));
|
||||||
texts.localized(
|
|
||||||
`settings_filters_update_status_complete`,
|
|
||||||
null,
|
|
||||||
[filter_URL],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// Inform the user of the download failure.
|
// Inform the user of the download failure.
|
||||||
alerts.error(
|
alerts.error(error.name, texts.localized(`settings_filters_update_status_failure`, null, [error.name, filter_URL]), error.stack);
|
||||||
texts.localized(`settings_filters_update_status_failure`, null, [
|
|
||||||
error,
|
|
||||||
filter_URL,
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue