Files
redash/client/app/lib/promise-rejection-error.js
2018-02-08 09:33:03 +02:00

20 lines
644 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export default class PromiseRejectionError extends Error {
constructor(rejection) {
let message;
if (rejection.status !== undefined) {
if (rejection.status === 404) {
message = "It seems like the page you're looking for cannot be found.";
} else if (rejection.status === 403 || rejection.status === 401) {
message = 'It seems like you dont have permission to see this page.';
}
}
if (message === undefined) {
message = 'It seems like we encountered an error. Try refreshing this page or contact your administrator.';
}
super(message);
this.rejection = rejection;
}
}