GNU bug report logs - #37480
27.0.50; uncaught exception

Previous Next

Package: emacs;

Reported by: Christian Johansson <christian <at> cvj.se>

Date: Sun, 22 Sep 2019 14:03:01 UTC

Severity: normal

Tags: moreinfo

Found in version 27.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christian Johansson <christian <at> cvj.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37480 <at> debbugs.gnu.org
Subject: bug#37480: 27.0.50; uncaught exception
Date: Mon, 23 Sep 2019 07:18:25 +0200
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 <at> debbugs.gnu.org
>> From: Christian Johansson <christian <at> cvj.se>
>> 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.




This bug report was last modified 5 years and 192 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.