13 lines
339 B
JavaScript
13 lines
339 B
JavaScript
// 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) {
|
|
return (error) => {
|
|
if (codesForError(error).includes('403')) {
|
|
route.set('isForbidden', true);
|
|
} else {
|
|
throw error;
|
|
}
|
|
};
|
|
}
|