fix: improve default error handling #1379 #1409#1439
Conversation
accdd8c to
c5ab6b3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1439 +/- ##
==========================================
+ Coverage 95.19% 95.28% +0.08%
==========================================
Files 43 43
Lines 3119 3136 +17
==========================================
+ Hits 2969 2988 +19
+ Misses 150 148 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c5ab6b3 to
883b09e
Compare
883b09e to
05150ae
Compare
ZohebShaikh
left a comment
There was a problem hiding this comment.
Looks good only few things can be tidied up
1374dc7 to
84ab80b
Compare
84ab80b to
f33a736
Compare
| with pytest.raises(BlueskyRemoteControlError) as exception: | ||
| client.resume() | ||
| assert "<Response [400]>" in str(exception) | ||
| assert exception.value.args[0] |
There was a problem hiding this comment.
What are these asserts testing for?
There was a problem hiding this comment.
It was a leftover from when BlueskyRemoteControlError had a fixed response that broke with the new error messsages. It only checks the body is non-empty. I can remove this or I could add a description to the 400 responses in set_state, like "Cannot transition from {current_state} to {new_state}") and check that instead? might be better for debugging
Poor grammar. Co-authored-by: Peter Holloway <peter.holloway@diamond.ac.uk>
… having an effect when running plans - you'll still get the Unauthorised request message"
Fixes #1379
Fixes #1409
Both issues related to error handling in the REST client.
1379 - Catches 'UnauthorisedAccessError
explicitly instead of string-matching onBlueskyRemoteControlError`.1409 - Expands the exception hierarchy so each
HTTP status code raises a distinct typed exception rather than bundling
everything into
BlueskyRemoteControlError.Tests
runcommand