You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The client __call catches AssertionError and raises a BadRequest instead. However most (or all?) methods that call __call themselves are trying to catch AssertionError, which will never actually be raised because __call already handles it.
The end result is that all of the "except AssertionError" blocks are never triggered and the exception is propagated instead of being caught, which is probably not intentional (I suspect that the custom BadRequest exception was implemented later).
However, I think it is actually useful to propagate the exceptions to that client code can handle them appropriately, instead of just returning a bool on an error, so I lean more towards removing all of those try/catch blocks entirely and changing the __call and __call_stream methods to raise something that allows users to determine the underlying problem and decide what they want to do.
The text was updated successfully, but these errors were encountered:
Note that this limits the amount of test coverage that can be achieved as well; because __call catches all AssertionErrors and converts them to BadRequests, it's impossible to cover any of the except AssertionError lines in the functions that call __call, as no AssertionError will be raised (unless you mock __call to raise them, which is a bit pointless).
The client __call catches AssertionError and raises a BadRequest instead. However most (or all?) methods that call __call themselves are trying to catch AssertionError, which will never actually be raised because __call already handles it.
The end result is that all of the "except AssertionError" blocks are never triggered and the exception is propagated instead of being caught, which is probably not intentional (I suspect that the custom BadRequest exception was implemented later).
However, I think it is actually useful to propagate the exceptions to that client code can handle them appropriately, instead of just returning a bool on an error, so I lean more towards removing all of those try/catch blocks entirely and changing the __call and __call_stream methods to raise something that allows users to determine the underlying problem and decide what they want to do.
The text was updated successfully, but these errors were encountered: