Skip to content

Commit

Permalink
Merge pull request #4209 from fossasia/development
Browse files Browse the repository at this point in the history
  • Loading branch information
iamareebjamal authored Mar 9, 2020
2 parents b85fa50 + 99b652a commit 0de77a4
Show file tree
Hide file tree
Showing 54 changed files with 1,537 additions and 1,353 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
],
'max-len': 'off',
'no-console': ["error", { allow: ["warn", "error"] }],
'prefer-template': 'error',
'prefer-template': 'off',
'camelcase': 'off',
'new-cap': 'off',
'eqeqeq': ['error', 'smart'],
Expand Down
3 changes: 2 additions & 1 deletion app/components/account/danger-zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export default Component.extend({
id: 'account_Delete'
});
})
.catch(() => {
.catch(e => {
console.error('Error while deleting account', e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'), {
id: 'account_del_error'
});
Expand Down
3 changes: 2 additions & 1 deletion app/components/account/email-preferences-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default Component.extend({
id: 'email_notif'
});
})
.catch(() => {
.catch(e => {
console.error('Error while updating email notifications.', e);
emailPreference.rollbackAttributes();
this.notify.error(this.l10n.t('An unexpected error occurred.'), {
id: 'email_error'
Expand Down
3 changes: 2 additions & 1 deletion app/components/events/view/export/api-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export default Component.extend({
json = JSON.stringify(json, null, 2);
this.set('json', htmlSafe(syntaxHighlight(json)));
})
.catch(() => {
.catch(e => {
console.error('Error while fetching export JSON from server', e);
this.notify.error(this.l10n.t('Could not fetch from the server'), {
id: 'server_fetch_error'
});
Expand Down
7 changes: 5 additions & 2 deletions app/components/events/view/export/download-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export default Component.extend({
id: 'task_progress'
});
} else {
console.error('Event exporting task failed', exportJobStatus);
this.set('eventExportStatus', exportJobStatus.state);
this.notify.error(this.l10n.t('Task failed.'), {
id: 'task_fail'
});
}
})
.catch(() => {
.catch(e => {
console.error('Error while exporting event', e);
this.set('eventExportStatus', 'FAILURE');
this.notify.error(this.l10n.t('Task failed.'), {
id: 'task_failure'
Expand All @@ -64,7 +66,8 @@ export default Component.extend({
.then(exportJobInfo => {
this.requestLoop(exportJobInfo);
})
.catch(() => {
.catch(e => {
console.error('Error while starting exporting job', e);
this.set('isLoading', false);
this.notify.error(this.l10n.t('Unexpected error occurred.'), {
id: 'unexpected_down_error'
Expand Down
2 changes: 1 addition & 1 deletion app/components/events/view/export/download-zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class extends Component {
id: 'export_succ'
});
} catch (e) {
console.error(e);
console.error('Error while downloading event zip', e);
this.notify.error(this.l10n.t(e), {
id: 'err_down'
});
Expand Down
6 changes: 4 additions & 2 deletions app/components/events/view/overview/manage-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default Component.extend({
id: 'man_role'
});
})
.catch(() => {
.catch(e => {
console.error('Error while updating role invite', e);
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), {
id: 'man_role_err'
});
Expand All @@ -50,7 +51,8 @@ export default Component.extend({
});
this.get('data.roleInvites').removeObject(invite);
})
.catch(() => {
.catch(e => {
console.error('Error while deleting role invite', e);
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), {
id: 'err_man_role'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default Component.extend(FormMixin, {
});
})
.catch(e => {
console.warn(e);
console.error('Error while sending test email', e);
this.notify.error(this.l10n.t('An unexpected error has occurred'), {
id: 'test_mail_err'
});
Expand Down
3 changes: 2 additions & 1 deletion app/components/forms/admin/settings/ticket-fees-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export default Component.extend({
id: 'fee_delete_succ'
});
})
.catch(() => {
.catch(e => {
console.error('Error while deleting ticket', e);
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), {
id: 'fee_err'
});
Expand Down
3 changes: 3 additions & 0 deletions app/components/forms/login-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ export default class extends Component.extend(FormMixin) {
}
} catch (e) {
if (e.json && e.json.error) {
console.warn('Error while authentication', e);
this.set('errorMessage', this.l10n.tVar(e.json.error));
} else {
console.error('Error while authentication', e);
this.set('errorMessage', this.l10n.t('An unexpected error occurred.'));
}
}
Expand All @@ -89,6 +91,7 @@ export default class extends Component.extend(FormMixin) {
id: 'error_server_msg'
});
} else {
console.error('Error while facebook authentication', e);
this.notify.error(this.l10n.t('An unexpected error has occurred'), {
id: 'unexpect_error'
});
Expand Down
5 changes: 4 additions & 1 deletion app/components/forms/reset-password-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export default Component.extend(FormMixin, {
});
this.router.transitionTo('login');
})
.catch(() => {
.catch(e => {
console.error('Error while resetting password', e);
this.set('errorMessage', this.l10n.t('An unexpected error occurred.'), {
id: 'reset_unexpect'
});
Expand All @@ -86,8 +87,10 @@ export default Component.extend(FormMixin, {
})
.catch(reason => {
if (reason && Object.prototype.hasOwnProperty.call(reason, 'errors') && reason.errors[0].status === 404) {
console.warn('Reset Password: No user account found', reason);
this.set('errorMessage', this.l10n.t('No account is registered with this email address.'));
} else {
console.error('Error while submitting reset password', reason);
this.set('errorMessage', this.l10n.t('An unexpected error occurred.'));
}
})
Expand Down
1 change: 1 addition & 0 deletions app/components/forms/user-payment-info-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default class extends Component.extend(FormMixin) {
id: 'bill_det_updated'
});
} catch (error) {
console.error('Error while updating billing details', error);
this.authManager.currentUser.rollbackAttributes();
this.notify.error(this.l10n.t('An unexpected error occurred'), {
id: 'bill_det_unexpect'
Expand Down
3 changes: 2 additions & 1 deletion app/components/forms/user-profile-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export default Component.extend(FormMixin, {
id: 'profi_update'
});
})
.catch(() => {
.catch(e => {
console.error('Error while updating profile.', e);
this.get('authManager.currentUser').rollbackAttributes();
this.notify.error(this.l10n.t('An unexpected error occurred'), {
id: 'profi_error'
Expand Down
6 changes: 5 additions & 1 deletion app/components/forms/wizard/basic-details-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export default Component.extend(FormMixin, EventWizardMixin, {
later(this, () => {
try {
this.set('subTopic', null);
} catch (ignored) { /* To suppress error thrown in-case this gets executed after component gets destroy */ }
} catch (ignored) {
/* To suppress error thrown in-case this gets executed after component gets destroy */
console.warn('Error setting subTopic to null', ignored);
}
}, 50);
if (!this.get('data.event.topic')) {
return [];
Expand Down Expand Up @@ -403,6 +406,7 @@ export default Component.extend(FormMixin, EventWizardMixin, {
}));
})
.catch(error => {
console.error('Error while setting stripe authorization in event', error);
this.notify.error(this.l10n.t(`${error.message}. Please try again`), {
id: 'basic_detail_err'
});
Expand Down
3 changes: 2 additions & 1 deletion app/components/modals/change-image-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default ModalBase.extend({
id: 'placeholder_sav'
});
})
.catch(() => {
.catch(e => {
console.error('Error while saving placeholder.', e);
this.notify.error(this.l10n.t('An unexpected error has occurred. Placeholder not saved.'), {
id: 'placeholder_err'
});
Expand Down
5 changes: 4 additions & 1 deletion app/components/modals/modal-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export default UiModal.extend({
this._super(...arguments);
try {
$(this.element).modal('refresh');
} catch (ignored) { /* ignored exception */ }
} catch (ignored) {
/* ignored exception */
console.warn('Error refreshing modal', ignored);
}
},


Expand Down
3 changes: 2 additions & 1 deletion app/components/notification-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default Component.extend({
id: 'not_read_succ'
});
})
.catch(() => {
.catch(e => {
console.error('Error while marking notifications as read.', e);
this.notify.error(this.l10n.t('An unexpected error occurred.'), {
id: 'not_read_error'
});
Expand Down
3 changes: 2 additions & 1 deletion app/components/public/ticket-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default Component.extend(FormMixin, {
this.set('invalidPromotionalCode', false);
});
} catch (e) {
console.error('Error while applying access code', e);
this.set('invalidPromotionalCode', true);
}
try {
Expand Down Expand Up @@ -148,7 +149,7 @@ export default Component.extend(FormMixin, {
this.set('invalidPromotionalCode', true);
}
} catch (e) {
console.warn(e);
console.error('Error while applying discount code as promo code', e);
if (this.invalidPromotionalCode) {
this.set('invalidPromotionalCode', true);
}
Expand Down
3 changes: 2 additions & 1 deletion app/components/ui-table-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ export default ModelsTable.extend({
}
store.query(modelName, query)
.then(newData => setProperties(this, { isLoading: false, isError: false, filteredContent: newData }))
.catch(() => {
.catch(e => {
console.error('Error while querying data in UI Table', e);
if (!this.isDestroyed) {
setProperties(this, { isLoading: false, isError: true });
}
Expand Down
1 change: 1 addition & 0 deletions app/components/unverified-user-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default Component.extend({
this.set('isMailSent', true);
})
.catch(error => {
console.error('Error while sending verification email', error, error.error);
if (error.error) {
this.notify.error(this.l10n.t(error.error), {
id: 'ver_mail_serv_error'
Expand Down
4 changes: 3 additions & 1 deletion app/components/widgets/forms/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default Component.extend({
id: 'file_upload_succ'
});
})
.catch(() => {
.catch(e => {
console.error('Error while upload file', e);
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), {
id: 'file_upload_err'
});
Expand All @@ -47,6 +48,7 @@ export default Component.extend({
};
reader.readAsDataURL(files[0]);
}).catch(error => {
console.error('Error while reading file', error);
this.notify.error(error, {
id: 'file_upload_err_1'
});
Expand Down
4 changes: 3 additions & 1 deletion app/components/widgets/forms/image-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default Component.extend({
this.set('uploadingImage', false);
this.set('imageUrl', image.url);
})
.catch(() => {
.catch(e => {
console.error('Error while uploading and setting image URL', e);
this.set('uploadingImage', false);
this.set('errorMessage', this.i18n.t('An unexpected error occurred.'));
});
Expand All @@ -56,6 +57,7 @@ export default Component.extend({
reader.readAsDataURL(files[0]);

}).catch(error => {
console.error('Error while image reading and cropping', error);
this.notify.error(error, {
id: 'unexpected_image_upload_1'
});
Expand Down
1 change: 1 addition & 0 deletions app/controllers/account/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class extends Controller {
});
})
.catch(error => {
console.error('Error while updating password', error);
if (error.errors) {
this.notify.error(this.l10n.t(`${error.errors[0].detail}`),
{
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/account/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default class extends Controller {
{
id: 'cont_info_upd'
});
} catch (error) {
} catch (error) {
console.error('Error while updating contact info', error);
this.notify.error(this.l10n.t(error.message),
{
id: 'cont_upd_error'
Expand Down
7 changes: 5 additions & 2 deletions app/controllers/admin/content/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class extends Controller {
this.set('disableEventSubtopic', false);
this.set('currentTopicSelected', topic);
} catch (e) {
console.error('Error while updating subtopics', e);
this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.'),
{
id: 'subtop_error'
Expand Down Expand Up @@ -45,7 +46,8 @@ export default class extends Controller {
id: 'event_prop_del'
});
})
.catch(() => {
.catch(e => {
console.error('Error while deleting ' + modelName, e);
this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.'),
{
id: 'event_type_error'
Expand All @@ -68,7 +70,8 @@ export default class extends Controller {
id: 'mode_add_succ'
});
})
.catch(() => {
.catch(e => {
console.error('Error while adding ' + camelCasedValue, e);
this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`),
{
id: 'mode_err_succ'
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default class extends Controller {
id: 'social_link_upd'
});
})
.catch(() => {
.catch(e => {
console.error('Error updating social links', e);
this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.'),
{
id: 'unex_social_error'
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/content/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default class extends Controller {
id: 'page_detail_succ'
});
})
.catch(() => {
.catch(e => {
console.error('Error saving page details', e);
this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.'),
{
id: 'page_detail_del'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/content/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class extends Controller {
id: 'zip_generated_succ'
});
} catch (e) {
console.warn(e);
console.error('Error downloading translation zip', e);
this.notify.error(this.l10n.t('Unexpected error occurred.'),
{
id: 'zip_error'
Expand Down
Loading

0 comments on commit 0de77a4

Please sign in to comment.