Skip to content

Commit b85fa50

Browse files
authoredMar 7, 2020
fix: Handle error on event save property null (#4204)
1 parent 7e74d57 commit b85fa50

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
 

‎app/mixins/event-wizard.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
6060
}));
6161
for (const result of results) {
6262
if (result.status === 'fulfilled') {
63-
data[result.value.key] = result.value;
63+
if (result?.value?.key) {
64+
data[result.value.key] = result.value;
65+
} else {
66+
console.warn('No value for key while saving event', result);
67+
}
6468
}
6569
}
6670
const numberOfTickets = data.tickets ? data.tickets.length : 0;
@@ -144,9 +148,14 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
144148
this.transitionToRoute(route, data.id);
145149
})
146150
.catch(e => {
147-
e.errors.forEach(error => {
148-
this.notify.error(this.l10n.tVar(error.detail));
149-
});
151+
console.error('Error while saving event', e);
152+
if (e.errors) {
153+
e.errors.forEach(error => {
154+
this.notify.error(this.l10n.tVar(error.detail));
155+
});
156+
} else {
157+
this.notify.error(this.l10n.t('An unexpected error has occurred'));
158+
}
150159
})
151160
.finally(() => {
152161
this.set('isLoading', false);

0 commit comments

Comments
 (0)
Please sign in to comment.