Merge pull request #643 from sharetribe/log-fetch-current-user-error

Improve error logging
This commit is contained in:
Kimmo Puputti 2018-01-15 12:45:19 +02:00 committed by GitHub
commit c57a11f2dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -361,7 +361,7 @@ export const fetchCurrentUser = () => (dispatch, getState, sdk) => {
.catch(e => {
// Make sure auth info is up to date
dispatch(authInfo());
log.error(e, 'fetch-current-user-failed');
dispatch(currentUserShowError(storableError(e)));
});
};

View file

@ -172,7 +172,8 @@ export const isStripeInvalidPostalCode = error => {
});
};
export const storableError = error => {
export const storableError = err => {
const error = err || {};
const { name, message, status, statusText } = error;
// Status, statusText, and data.errors are (possibly) added to the error object by SDK
const apiErrors = responseAPIErrors(error);