wrap login call in try/catch for error handling
This commit is contained in:
parent
e0cc7ba3c3
commit
55512a2eae
1 changed files with 30 additions and 26 deletions
|
@ -160,6 +160,7 @@ export class Login extends Component<any, State> {
|
|||
if (username_or_email && password) {
|
||||
i.setState({ loginRes: { state: "loading" } });
|
||||
|
||||
try {
|
||||
const loginRes = await HttpService.client.login({
|
||||
username_or_email,
|
||||
password,
|
||||
|
@ -193,6 +194,9 @@ export class Login extends Component<any, State> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
i.setState({ loginRes: { state: "failed", msg: error.message } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue