Created
October 18, 2016 13:15
-
-
Save lmatteis/1a9da60b195fc159c2e0f3696859c6f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getErrorFromResponse = defaultMessage => error => | |
error.response.json().then(error => { | |
try { | |
return Promise.reject(error.error.exception[0].message) | |
} catch (e) { | |
return Promise.reject(defaultMessage) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment