emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: org-protocol-check-filename-for-protocol obscures other errors
Date: Sat, 15 Apr 2017 19:07:36 -0500	[thread overview]
Message-ID: <874lxpjjuf.fsf@alphapapa.net> (raw)

Hi,

I've found that catching errors at this spot in
org-protocol-check-filename-for-protocol (currently line 618 in the
file):

file:~/src/org-mode/lisp/org-protocol.el::(error

Is causing a couple of problems.

1.  Any error in the sub-protocol handler causes the handler to be
called a second time with an old-style link string.  I guess this is
okay if the reason for the error is the handler's not handling new-style
links, but if not, calling it a second time with the other string
doesn't work.

2.  Catching all errors here obscures any error in the sub-protocol
handler.  This makes it very difficult to debug the handler.

For example, in my handler I was calling call-process-region with a
final argument which should have been a string, but because of a bug in
my code the argument was nil, and this caused call-process-region to
give an error.  But the error was caught and replaced with the warning,
and then the handler was called a second time, which, of course, failed
again.  Even using edebug on the handler didn't help, because the error
was still obscured.  I had to take apart the handler and run each
expression manually to get to the real error.  (I tried temporarily
removing the condition-case from
org-protocol-check-filename-for-protocol, but for some reason that
didn't help--I probably did something wrong.)

Could this code be adjusted to help avoid this problem in the future?

Thanks.

             reply	other threads:[~2017-04-16  0:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-16  0:07 Adam Porter [this message]
2017-04-17  9:07 ` org-protocol-check-filename-for-protocol obscures other errors Nicolas Goaziou
2017-04-17 19:52   ` Adam Porter

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=874lxpjjuf.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).