emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-protocol-check-filename-for-protocol obscures other errors
@ 2017-04-16  0:07 Adam Porter
  2017-04-17  9:07 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Porter @ 2017-04-16  0:07 UTC (permalink / raw)
  To: emacs-orgmode

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-protocol-check-filename-for-protocol obscures other errors
  2017-04-16  0:07 org-protocol-check-filename-for-protocol obscures other errors Adam Porter
@ 2017-04-17  9:07 ` Nicolas Goaziou
  2017-04-17 19:52   ` Adam Porter
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2017-04-17  9:07 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-protocol-check-filename-for-protocol obscures other errors
  2017-04-17  9:07 ` Nicolas Goaziou
@ 2017-04-17 19:52   ` Adam Porter
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Porter @ 2017-04-17 19:52 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

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

Looks great, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-17 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-16  0:07 org-protocol-check-filename-for-protocol obscures other errors Adam Porter
2017-04-17  9:07 ` Nicolas Goaziou
2017-04-17 19:52   ` Adam Porter

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).