Collection dictionary access incorrectly folds all HTTP errors to KeyError
Bug #626960 reported by
Māris Fogels
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Distributed Development |
Invalid
|
High
|
Martin Pool | ||
lazr.restfulclient |
Fix Released
|
High
|
Martin Pool |
Bug Description
When accessing a collection as a dictionary, if the server is not available, then the collection will raise a KeyError. This makes programming errors (misspelled key names) impossible to tell apart from network issues.
When doing dictionary-like access on a collection, all server errors should raise a ServerError exception.
As a workaround, one can force ServerError to be raised by replacing dictionary-like access with method access:
>>> lp.project_
becomes
>>> lp.project_
Related branches
lp://staging/~mbp/lazr.restfulclient/626960-keyerror
- Graham Binns (community): Approve (code)
-
Diff: 15 lines (+4/-1)1 file modifiedsrc/lazr/restfulclient/resource.py (+4/-1)
Changed in lazr.restfulclient: | |
milestone: | none → 0.11.3 |
Changed in lazr.restfulclient: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I agree. I'll add this to the list of usability issues to consider soon.