Skip to content
Snippets Groups Projects
Commit 3764b23c authored by Eugen Ciur's avatar Eugen Ciur
Browse files

Meaningful error message if REST API server is not reachable

parent 6bda566b
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import Controller from '@ember/controller';
import { service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { base_url } from 'papermerge/utils';
export default class LoginController extends Controller {
......@@ -18,7 +19,14 @@ export default class LoginController extends Controller {
password
);
} catch (error) {
this.errorMessage = "Invalid credentials";
if (error instanceof TypeError) {
// TypeError is thrown by fetch API if there is a
// network issue e.g. backend server is not reachable;
let extra_message = `Please double check that REST API server '${base_url()}/' is reachable.`
this.errorMessage = `${error} ${extra_message}`;
} else {
this.errorMessage = error;
}
}
if (this.session.isAuthenticated) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment