Currently, when we try to parse a remote error, and its not a valid JSON payload, (such as some undefined errors and path errors) we return an error that is not a RemoteError, which also means that the specifics (status code & plain-text message) gets lost as well.
One solution
Add the ability to RemoteError to note what was the plain-text response in case the unmarshalling fails, such as a Plain []byte field noting the contents, an ID made on the fly, and correct RemoteError.Error handling.
The problem
Currently, when we try to parse a remote error, and its not a valid JSON payload, (such as some
undefined
errors and path errors) we return an error that is not a RemoteError, which also means that the specifics (status code & plain-text message) gets lost as well.One solution
Add the ability to RemoteError to note what was the plain-text response in case the unmarshalling fails, such as a
Plain []byte
field noting the contents, an ID made on the fly, and correctRemoteError.Error
handling.