From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: org-protocol-check-filename-for-protocol obscures other errors Date: Sat, 15 Apr 2017 19:07:36 -0500 Message-ID: <874lxpjjuf.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czXjJ-00047u-PJ for emacs-orgmode@gnu.org; Sat, 15 Apr 2017 20:07:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czXjG-0007J0-KG for emacs-orgmode@gnu.org; Sat, 15 Apr 2017 20:07:49 -0400 Received: from [195.159.176.226] (port=44797 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1czXjG-0007IC-DP for emacs-orgmode@gnu.org; Sat, 15 Apr 2017 20:07:46 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1czXj8-0002PM-LE for emacs-orgmode@gnu.org; Sun, 16 Apr 2017 02:07:38 +0200 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: emacs-orgmode@gnu.org 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.