send an axios put request and getting status code 400 error.
Server sends a user friendly validation eror message
it looks like in dev tools:

in catch block I expect to get the message with error.message but this equals to Request failed with status code 400
try {
dispatch({
type: SETTINGS_ALERT,
})
const response = await axios.put(
`/author/me`,
{
data: {
DisplayName: displayName,
Description: description,
},
}
)
dispatch({
type: SETTINGS_UPDATE_PROFILE_SUCCESS,
payload: response.data,
})
} catch (error) {
//need to handle it here, bu error.message not works
dispatch({
type: SETTINGS_LOAD_FAIL,
error: error.message,
})
}
How can I read this message properly??
console.log(String(error)first. See what comes up.