Skip to content

Commit

Permalink
fix: Handle error on event save property null (#4204)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamareebjamal authored Mar 7, 2020
1 parent 7e74d57 commit b85fa50
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/mixins/event-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
}));
for (const result of results) {
if (result.status === 'fulfilled') {
data[result.value.key] = result.value;
if (result?.value?.key) {
data[result.value.key] = result.value;
} else {
console.warn('No value for key while saving event', result);
}
}
}
const numberOfTickets = data.tickets ? data.tickets.length : 0;
Expand Down Expand Up @@ -144,9 +148,14 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
this.transitionToRoute(route, data.id);
})
.catch(e => {
e.errors.forEach(error => {
this.notify.error(this.l10n.tVar(error.detail));
});
console.error('Error while saving event', e);
if (e.errors) {
e.errors.forEach(error => {
this.notify.error(this.l10n.tVar(error.detail));
});
} else {
this.notify.error(this.l10n.t('An unexpected error has occurred'));
}
})
.finally(() => {
this.set('isLoading', false);
Expand Down

0 comments on commit b85fa50

Please sign in to comment.