If the server returns an error object in a 400/500 response, the client still tries to deserialize it as the type it was originally expecting. This results in either a JsonSerializationException or a RestException with no useful message. As such, the user cannot see the error that came from the server, making it difficult to determine the cause of the error.
To fix this, we should throw a RestException containing the error message from the server.
If the server returns an error object in a 400/500 response, the client still tries to deserialize it as the type it was originally expecting. This results in either a JsonSerializationException or a RestException with no useful message. As such, the user cannot see the error that came from the server, making it difficult to determine the cause of the error.
To fix this, we should throw a RestException containing the error message from the server.