all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: era eriksson <era@iki.fi>
To: 19768@debbugs.gnu.org
Cc: era+emacs@iki.fi
Subject: bug#19768: json.el: end-of-file errors untrappable
Date: Wed, 04 Feb 2015 15:59:43 +0200	[thread overview]
Message-ID: <1423058383.3713286.222999749.0FE1B22B@webmail.messagingengine.com> (raw)

Package: emacs
Version: 24.3.1
X-Debbugs-Cc: era+emacs@iki.fi

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.





             reply	other threads:[~2015-02-04 13:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 13:59 era eriksson [this message]
2015-02-04 15:34 ` bug#19768: json.el: end-of-file errors untrappable Stefan Monnier
2015-02-05 11:51   ` era eriksson
2015-02-05 19:52     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423058383.3713286.222999749.0FE1B22B@webmail.messagingengine.com \
    --to=era@iki.fi \
    --cc=19768@debbugs.gnu.org \
    --cc=era+emacs@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.