--- Begin Message ---
Subject: |
json.el: end-of-file errors untrappable |
Date: |
Wed, 04 Feb 2015 15:59:43 +0200 |
Package: emacs
Version: 24.3.1
X-Debbugs-Cc: address@hidden
The code in json.el uses (signal 'end-of-file) in many scenarios.
Unfortunately, the default value of debug-ignore-errors causes these
errors to bypass any error checking, and unhelpfully land in the
*Messages* buffer with little indication as to what went wrong or which
code path caused this message.
Once you know this, debugging json-read is easy; but the fix is
unobvious, and might have unintended side effects.
Steps to repro:
(require 'json)
(setq debug-on-error t)
(json-read-from-string "")
Expected result:
*Backtrace* showing where something went wrong
Actual result:
json-read: End of file during parsing
(The "json-read:" prefix is not visible in the minibuffer message for
me, but it lands in the *Messages* buffer.)
Workaround:
(let (debug-ignore-errors)
(json-read-from-string ""))
I'm not sure what the proper fix should be. Maybe these occurrences
could be changed to json-end-of-file or something? Or maybe json-read
could include the 'let' form from the workaround.
See also:
http://stackoverflow.com/questions/28317081/debug-on-error-vs-debug-on-signal-in-json-el-in-particular
/* era */
--
If this were a real .signature, it would suck less. Well, maybe not.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#19768: json.el: end-of-file errors untrappable |
Date: |
Thu, 05 Feb 2015 14:52:39 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> https://github.com/tripleee/emacs/tree/bug19768 contains a simple patch
> which implements this, but I am uncertain how to test it. Also, I am
> having second thoughts about defining the new error symbol as a child of
> 'end-of-file when all the other error symbols neatly inherit from
> 'json-error. Anyway, feel free to review and/or pull and/or ignore. (-:
Installed, making it inherit from both kinds of errors ;-)
Stefan
--- End Message ---