2017-10-24 23:06:58 +00:00
|
|
|
// An error handler to provide to a promise catch to set a
|
|
|
|
// forbidden flag on the route
|
|
|
|
import codesForError from './codes-for-error';
|
|
|
|
export default function notifyForbidden(route) {
|
2021-12-28 14:45:20 +00:00
|
|
|
return (error) => {
|
2017-10-24 23:06:58 +00:00
|
|
|
if (codesForError(error).includes('403')) {
|
|
|
|
route.set('isForbidden', true);
|
|
|
|
} else {
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|