[tahoe-lafs-trac-stream] [tahoe-lafs] #1799: Document how to distinguish exceptions from JSON, or encode exceptions as JSON

tahoe-lafs trac at tahoe-lafs.org
Fri Aug 31 15:06:29 UTC 2012


#1799: Document how to distinguish exceptions from JSON, or encode exceptions as
JSON
-----------------------------------+---------------------------------
     Reporter:  davidsarah         |      Owner:
         Type:  defect             |     Status:  new
     Priority:  normal             |  Milestone:  undecided
    Component:  code-frontend-web  |    Version:  1.9.2
   Resolution:                     |   Keywords:  json usability docs
Launchpad Bug:                     |
-----------------------------------+---------------------------------
Description changed by davidsarah:

Old 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.

New 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.

--

-- 
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1799#comment:1>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list