Opened at 2012-08-31T15:06:06Z
Last modified at 2012-08-31T21:16:33Z
#1799 new defect
Document how to distinguish exceptions from JSON, or encode exceptions as JSON — at Initial Version
Reported by: | davidsarah | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | undecided |
Component: | code-frontend-web | Version: | 1.9.2 |
Keywords: | json usability docs | Cc: | darrob |
Launchpad Bug: |
Description
darrob: hello again. i have a python program that runs tahoe repair operations using urllib and parses tahoe's json responses. this works very well except for one thing: if a file is gone and i attempt a repair, the resulting NotEnoughSharesError? is not presented as json data but plaintext (a check without repair responds in json, however).
darrob: am i missing something on tahoe's side that i can do about it? if not, are there other error messages like this that i should be aware of before i adapt the program?
We need to document how to distinguish exceptions (I *think* valid JSON always starts with a "{" or "[" character).
An alternative would be to encode the exception as JSON (i.e. something like {"exception": "..."}), although that would make it more difficult to read. Since these APIs are mainly for programmatic use, that might be acceptible.