ox.jsonc fails ungracefully on parse errors if simplejson is not in use #2858
Labels
No Label
backend
critical
defect
duplicate
enhancement
fixed
frontend
general
invalid
major
minor
normal
oxjs
pandora_client
python-ox
task
trivial
wontfix
worksforme
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: 0x2620/pandora#2858
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
simplejson
defines and raisesJSONDecodeError
with nicelineno
,colno
attributes; butjson
(which is used ifsimplejson
is not installed just raisesValueError
with the line/column range information mangled into the string.ox might or might not try to parse the string and give (useful) contextual information; but at least it shouldn't throw
AttributeError
.Attachment 0001-jsonc-handle-parse-errors-from-json-gracefully-fixes.patch (1967 bytes) added
Currently never uses simplejson.JSONDecodeError since you check for _JSONDecodeError not JSONDecodeError. Since that also works with simplejson, all those checks can be removed.
Needs to be fixed to work with python3.4+ (python-ox also should work with python 3.4+) since message is no longer available:
AttributeError: 'ValueError' object has no attribute 'message'
will push with those changes fixed in a bit.
In [python-ox,735]changeset:"python-ox,735":
[]changeset:pandora,5071 uses this and improves the error message if an invalid config files is passed.
Replying to [j]comment:3:
Great, failing hard during init would have saved me a bit of debugging time. Thanks!