From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-protocol-check-filename-for-protocol obscures other errors Date: Mon, 17 Apr 2017 11:07:09 +0200 Message-ID: <87vaq3mmgy.fsf@nicolasgoaziou.fr> References: <874lxpjjuf.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d02cu-0001iM-FQ for emacs-orgmode@gnu.org; Mon, 17 Apr 2017 05:07:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d02cr-0005Z9-8P for emacs-orgmode@gnu.org; Mon, 17 Apr 2017 05:07:16 -0400 Received: from relay7-d.mail.gandi.net ([2001:4b98:c:538::200]:35789) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d02cr-0005Yi-2D for emacs-orgmode@gnu.org; Mon, 17 Apr 2017 05:07:13 -0400 In-Reply-To: <874lxpjjuf.fsf@alphapapa.net> (Adam Porter's message of "Sat, 15 Apr 2017 19:07:36 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Adam Porter Cc: emacs-orgmode@gnu.org Hello, Adam Porter 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