improve error messages when failing to talk to a HS
This commit is contained in:
parent
c053f90b18
commit
b4fe9473d5
1 changed files with 23 additions and 4 deletions
|
@ -129,11 +129,30 @@ module.exports = React.createClass({displayName: 'Login',
|
||||||
if (!errCode && err.httpStatus) {
|
if (!errCode && err.httpStatus) {
|
||||||
errCode = "HTTP " + err.httpStatus;
|
errCode = "HTTP " + err.httpStatus;
|
||||||
}
|
}
|
||||||
this.setState({
|
|
||||||
errorText: (
|
var errorText = "Error: Problem communicating with the given homeserver " +
|
||||||
"Error: Problem communicating with the given homeserver " +
|
|
||||||
(errCode ? "(" + errCode + ")" : "")
|
(errCode ? "(" + errCode + ")" : "")
|
||||||
)
|
|
||||||
|
if (err.cors === 'rejected') {
|
||||||
|
if (window.location.protocol === 'https:' &&
|
||||||
|
(this.state.enteredHomeserverUrl.startsWith("http:") ||
|
||||||
|
!this.state.enteredHomeserverUrl.startsWith("http")))
|
||||||
|
{
|
||||||
|
errorText = <span>
|
||||||
|
Can't connect to homeserver via HTTP when using a vector served by HTTPS.
|
||||||
|
Either use HTTPS or <a href='https://www.google.com/search?&q=enable%20unsafe%20scripts'>enable unsafe scripts</a>
|
||||||
|
</span>;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
errorText = <span>
|
||||||
|
Can't connect to homeserver - please check your connectivity and ensure
|
||||||
|
your <a href={ this.state.enteredHomeserverUrl }>homeserver's SSL certificate</a> is trusted.
|
||||||
|
</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
errorText: errorText
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue