bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37480: 27.0.50; uncaught exception


From: Christian Johansson
Subject: bug#37480: 27.0.50; uncaught exception
Date: Sun, 22 Sep 2019 17:26:28 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi!

Alright, I would like to do something like this:

(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

Hälsningar / Best Regards
Christian

On 2019-09-22 16:50, Eli Zaretskii wrote:
From: Christian Johansson <christian@cvj.se>
Date: Sun, 22 Sep 2019 16:00:38 +0200

I want to handle errors occurring in asynchronous threads like in this
example, is it possible?
For some value of "possible".  From the ELisp manual:

      When code run by a thread signals an error that is unhandled, the
   thread exits.  Other threads can access the error form which caused the
   thread to exit using the following function.

    -- Function: thread-last-error
        This function returns the last error form recorded when a thread
        exited due to an error.  Each thread that exits abnormally
        overwrites the form stored by the previous thread’s error with a
        new value, so only the last one can be accessed.

(make-thread
(lambda()
(message "Start of asynchronous thread")
(signal 'error '("Fatal error"))
(message "End of asynchronous thread")))
I'm not sure I understand what you tried to accomplish with this code.
It doesn't seem to handle errors in any way.  Could you explain what
you are trying to do?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]