From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Christian Johansson Newsgroups: gmane.emacs.bugs Subject: bug#37480: 27.0.50; uncaught exception Date: Mon, 23 Sep 2019 07:18:25 +0200 Message-ID: <06831c73-1a16-7e53-e872-f3fe97df534d@cvj.se> References: <838sqgqtam.fsf@gnu.org> <8336goqr10.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60673"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: 37480@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 23 07:19:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iCGki-000Ff1-Oy for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Sep 2019 07:19:12 +0200 Original-Received: from localhost ([::1]:52306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCGkh-0003kj-3S for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Sep 2019 01:19:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48095) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCGkZ-0003ka-Pj for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 01:19:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCGkY-0002sb-MO for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 01:19:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54299) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCGkY-0002sP-7f for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 01:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iCGkY-0004tc-1u for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 01:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christian Johansson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Sep 2019 05:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37480 X-GNU-PR-Package: emacs Original-Received: via spool by 37480-submit@debbugs.gnu.org id=B37480.156921591818786 (code B ref 37480); Mon, 23 Sep 2019 05:19:01 +0000 Original-Received: (at 37480) by debbugs.gnu.org; 23 Sep 2019 05:18:38 +0000 Original-Received: from localhost ([127.0.0.1]:34887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCGkA-0004sv-9v for submit@debbugs.gnu.org; Mon, 23 Sep 2019 01:18:38 -0400 Original-Received: from cvj.se ([31.192.230.63]:39794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCGk7-0004sk-LD for 37480@debbugs.gnu.org; Mon, 23 Sep 2019 01:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cvj.se; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=aokG/ScZwFRR9ytPmotpc0rklVjfvuqzJxeyUCr7abU=; b=QJNAN4dhcY79Q41F/sOpFqCeRQxMRkRPKs3Gz+RONTWExoyakHiMUXduCqjjiD3jQ8hc8/z62rrKwUFscR6a16V6tbU2cF3fX5+zbARGu7X49jUqVvVExsJp/+H7yK95nQp+jjql5iw9y/ScSE89Kc2m03DWrBKsweUVHYeTDX0=; Original-Received: from m83-185-88-226.cust.tele2.se ([83.185.88.226] helo=Christians-MacBook-Air.local) by cvj.se with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1iCGk5-00052R-Du; Mon, 23 Sep 2019 07:18:33 +0200 In-Reply-To: <8336goqr10.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:166957 Archived-At: Hi Alright, I didn't know about that function. Can you give an example of how to use it? It tried the following but it doesn't work, it seems the thread dies after the signal and I'm not sure were it exits. (make-thread  (lambda()    (message "Start of asynchronous thread")    (signal 'error '("Fatal error"))    (message "End of asynchronous thread")    (message "Last error %s" (thread-last-error)))) For my ssh-deploy plugin, sometimes a asynchronous process or thread gets an error, could be network issues for instance and I would like to be able to handle these cases. I'm trying to make sure there is only one asynchronous process or thread simultaneously related to a local file, this is to avoid race conditions that otherwise occur with my plugin, especially when on a bad connection. I would be interested in exploring how to signal the main thread from the created thread, where can I read more about that? Hälsningar / Best Regards Christian On 2019-09-22 17:39, Eli Zaretskii wrote: >> Cc: 37480@debbugs.gnu.org >> From: Christian Johansson >> Date: Sun, 22 Sep 2019 17:26:28 +0200 >> >> (condition-case >>     nil >>     (make-thread >>      (lambda() >>        (message "Start of asynchronous thread") >>        (signal 'error '("Fatal error")) >>        (message "End of asynchronous thread"))) >>   (message "Catched error")) >> >> I have a case were a error occurs inside a tramp thread and I would like >> to be able to handle it > You don't need condition-case in this case, you just need to examine > the value of thread-last-error when the thread exits. > > Alternatively, you could try making the thread you start signal the > main thread, then the main thread should be able to catch that error. > > In general, errors are thread-local, so you cannot catch an error > signaled in another thread.