Skip to content

Commit f8cf8c1

Browse files
kushthedudeiamareebjamal
authored andcommitted
fix: Displaying more informative error on Stripe Failure (#3694)
1 parent e7929ff commit f8cf8c1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

app/controllers/orders/pending.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,17 @@ export default Controller.extend({
130130
})
131131
.catch(e => {
132132
console.warn(e);
133-
this.notify.error(this.l10n.t('An unexpected error has occurred'),
134-
{
135-
id: 'unexpected_error_occur'
136-
});
133+
if ('errors' in e) {
134+
this.notify.error(this.l10n.tVar(e.errors[0].detail),
135+
{
136+
id: 'unexpected_error_occur'
137+
});
138+
} else {
139+
this.notify.error(this.l10n.tVar(e),
140+
{
141+
id: 'unexpected_error_occur'
142+
});
143+
}
137144
})
138145
.finally(() => {
139146
this.set('isLoading', false);

0 commit comments

Comments
 (0)