emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Adam Porter <adam@alphapapa.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-protocol-check-filename-for-protocol obscures other errors
Date: Mon, 17 Apr 2017 11:07:09 +0200	[thread overview]
Message-ID: <87vaq3mmgy.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <874lxpjjuf.fsf@alphapapa.net> (Adam Porter's message of "Sat, 15 Apr 2017 19:07:36 -0500")

Hello,

Adam Porter <adam@alphapapa.net> writes:

> 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?

I tried to improve the situation in maint branch. Please let me know if
it makes your life easier !

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2017-04-17  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-16  0:07 org-protocol-check-filename-for-protocol obscures other errors Adam Porter
2017-04-17  9:07 ` Nicolas Goaziou [this message]
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=87vaq3mmgy.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=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).