Skip to content

Commit

Permalink
Flu.x: better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzzzen committed Feb 10, 2019
1 parent 6af1669 commit 7ccb647
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion objects/handlers/ProviderHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ class ProviderHandler {

if (!cache[i].flux) {
DataValidator.onDataUpload(cache[i]);
await UI.indicator(flux.upload(cache[i]), 'providers-flux-uploading');

try {
await UI.indicator(flux.upload(cache[i]), 'providers-flux-uploading');
}
catch(err) {
console.error(err);
UI.status('providers-flux-upload-error');
}
}

DataValidator.onDataStore(cache[i]);
Expand Down
1 change: 1 addition & 0 deletions objects/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"providers-error-outdated": "%s: Data is outdated!",
"providers-error-perks": "Could not gather perks for %s (%s)",
"providers-flux-uploading": "Uploading data to Flu.x",
"providers-flux-upload-error": "Couldn't upload data to Flu.x",
"providers-order": "Providers order",
"providers-skipped": "%s has been skipped because of missing function: #%s",
"reset-settings-button": "Reset",
Expand Down
1 change: 1 addition & 0 deletions objects/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"providers-error-outdated": "%s: les données ne sont pas à jour pour le dernier patch",
"providers-error-perks": "Could not gather runes for %s (%s)",
"providers-flux-uploading": "Téléversement des données vers Flu.x",
"providers-flux-upload-error": "Une erreur est survenue lors du téléversement",
"providers-order": "Ordre des fournisseurs",
"providers-skipped": "%s à été sauté à cause d'une méthode manquante: #%s",
"reset-settings-button": "Réinitialiser",
Expand Down
2 changes: 1 addition & 1 deletion objects/providers/Flux.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FluxProvider extends Provider {
* @param {object} data - The data that contains perks, summonerspells etc
*/
async upload(data) {
if (Object.values(data.roles).some(x => Array.isArray(x) && x.length === 0)) return console.log(2, 'Upload cancelled: missing data');
if (Object.values(data.roles).some(x => Array.isArray(x) && x.length === 0)) return console.log(2, '[Flu.x] Upload cancelled: missing data');
if (data.flux) return;

return await rp({
Expand Down

0 comments on commit 7ccb647

Please sign in to comment.