Skip to content

Commit a623dbd

Browse files
committed
Auto merge of #2825 - Turbo87:error-handling, r=locks
Fix error handling for errors without an `errors` property These error handlers should just rethrow the original error if no `errors` propery exists. r? `@locks`
2 parents 0bff22c + 333bfc3 commit a623dbd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/routes/team.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ export default Route.extend({
2121

2222
return { crates, team };
2323
} catch (e) {
24-
if (e.errors.some(e => e.detail === 'Not Found')) {
24+
if (e.errors?.some(e => e.detail === 'Not Found')) {
2525
this.notifications.error(`Team '${params.team_id}' does not exist`);
2626
return this.replaceWith('index');
2727
}
28+
29+
throw e;
2830
}
2931
},
3032
});

app/routes/user.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export default Route.extend({
2020

2121
return { crates, user };
2222
} catch (e) {
23-
if (e.errors.some(e => e.detail === 'Not Found')) {
23+
if (e.errors?.some(e => e.detail === 'Not Found')) {
2424
this.notifications.error(`User '${params.user_id}' does not exist`);
2525
return this.replaceWith('index');
2626
}
27+
28+
throw e;
2729
}
2830
},
2931
});

0 commit comments

Comments
 (0)