mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Show standard error messages.
This commit is contained in:
parent
d6eb8f436f
commit
e69f8fa009
@ -8,9 +8,6 @@
|
||||
</div>
|
||||
<div class="error-state__details">
|
||||
<h4>{{ $ctrl.handler.error.message }}</h4>
|
||||
<p>It seems like the page you’re looking for cannot be found.</p>
|
||||
<!--<p>It seems like you don’t have permission to see this page.</p>-->
|
||||
<!--<p>It seems like we encountered an error. Try refresh this page or contact your administrator.</p>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,10 +1,18 @@
|
||||
export default class PromiseRejectionError extends Error {
|
||||
constructor(rejection) {
|
||||
let message;
|
||||
switch (rejection.status) {
|
||||
case 403: message = 'You have no permissions to view this page.'; break;
|
||||
default: message = rejection.data.message; break;
|
||||
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 don’t 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user