fix: make sure to return the error if the json was invalid
If the server returns an error not in json, it was ignored. This MR makes sure the error is detected and forwarded to the client even if the json body could not be decoded (only the status will be known).