When this library is used as a client and the server returns a response
that was not declared in the operation's responses, an exception is
raised. Right now, this is a RuntimeError with a message explaining
what code was returned, and that it was undocumented. This is not
useful when using the client against an API whose documentation you do
not control, and that is missing exhaustive documentation for responses
(generally error responses fall into this category).
This change adds a new error type, openapi3.UnexpectedResponseError,
and raises that instead of RuntimeError. In addition to the message,
this error includes the full response that was returned, the operation
that made the call, and the status code that was not expected. This new
error is a subclass of RuntimeError to preserve backward
compatibility.
Closes #80
When this library is used as a client and the server returns a response that was not declared in the operation's responses, an exception is raised. Right now, this is a
RuntimeError
with a message explaining what code was returned, and that it was undocumented. This is not useful when using the client against an API whose documentation you do not control, and that is missing exhaustive documentation for responses (generally error responses fall into this category).This change adds a new error type,
openapi3.UnexpectedResponseError
, and raises that instead ofRuntimeError
. In addition to the message, this error includes the full response that was returned, the operation that made the call, and the status code that was not expected. This new error is a subclass ofRuntimeError
to preserve backward compatibility.