Cleanup fetch error & add details to sso (#4642) (#4643)

(cherry picked from commit bba139726d)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2020-08-04 20:02:15 +02:00 committed by GitHub
parent bcec21d264
commit c6978c858a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -89,6 +89,7 @@ Client4.doFetchWithResponse = async (url, options) => {
message: 'You need to use a valid client certificate in order to connect to this Mattermost server',
status_code: 401,
url,
details: err,
});
}
@ -99,6 +100,7 @@ Client4.doFetchWithResponse = async (url, options) => {
defaultMessage: 'Received invalid response from the server.',
},
url,
details: err,
});
}
@ -138,7 +140,7 @@ Client4.doFetchWithResponse = async (url, options) => {
}
throw new ClientError(Client4.getUrl(), {
message: `${msg} url = ${url}`,
message: msg,
server_error_id: data.id,
status_code: data.status_code,
url,

View file

@ -210,7 +210,15 @@ class SSO extends PureComponent {
onLoadEndError = (e) => {
console.warn('Failed to set store from local data', e); // eslint-disable-line no-console
this.setState({error: e.message});
let error = e.message;
if (e.details) {
error += `\n${e.details.message}`;
}
if (e.url) {
error += `\nURL: ${e.url}`;
}
this.setState({error});
};
scheduleSessionExpiredNotification = () => {