-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Anyway to get error message which is returned by server #307
Comments
The error contains 2 extra items, try {
const response = await registerApi.post({
email: this.email,
password: this.password,
passwordConfirmed: this.passwordRepeat,
})
resolve(response)
} catch (error) {
console.log('ServerError', await error.response.json())
reject(error)
} |
Hello, I am also looking to catch the error from server try {
await this.api.post(deviceId + '/group/' + groupId + 's');
}
catch (error) {
console.log(await error.response.json());
} await error.response.json() - returned: Uncaught (in promise) TypeError: Failed to execute 'json' on 'Response': body stream already read |
|
Thanks! |
@johannesronaldsson You can access to the data using: try {
const login = await api.post(apiUri, credentials);
} catch (error) {
console.error(error.body)
} |
Was this issue resolved? |
Hi there, i will just test it out. |
I created #378 to track |
Hi there,
i am trying to use mande.
Is there any way to catch the error is given from server.
For an example:
registerApi
is a mande instance. The server returns for me i this case422 (Unprocessable Entity)
and an error message.So how can i show this error message?
console.log('ServerError', error)
showsServerError Error: Unprocessable Entity
.Thank you in advance
The text was updated successfully, but these errors were encountered: