mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-18 06:35:35 +08:00
Merge pull request #935 from matrix-org/luke/new-guest-access-no-barf-on-username-check-err
Show "Something went wrong!" when errcode undefined
This commit is contained in:
commit
ed79a3adef
@ -108,6 +108,7 @@ export default React.createClass({
|
|||||||
const newState = {
|
const newState = {
|
||||||
usernameCheckSupport: err.errcode !== "M_UNRECOGNIZED",
|
usernameCheckSupport: err.errcode !== "M_UNRECOGNIZED",
|
||||||
};
|
};
|
||||||
|
console.error('Error whilst checking username availability: ', err);
|
||||||
switch (err.errcode) {
|
switch (err.errcode) {
|
||||||
case "M_USER_IN_USE":
|
case "M_USER_IN_USE":
|
||||||
newState.usernameError = 'Username not available';
|
newState.usernameError = 'Username not available';
|
||||||
@ -120,8 +121,11 @@ export default React.createClass({
|
|||||||
// fine and rely on the error appearing in registration step.
|
// fine and rely on the error appearing in registration step.
|
||||||
newState.usernameError = '';
|
newState.usernameError = '';
|
||||||
break;
|
break;
|
||||||
|
case undefined:
|
||||||
|
newState.usernameError = 'Something went wrong!';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
newState.usernameError = 'An error occurred' + err.message;
|
newState.usernameError = 'An error occurred: ' + err.message;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
|
Loading…
Reference in New Issue
Block a user