Subject: bug#37480: 27.0.50; uncaught exception

From: Eli Zaretskii <[email-masked]>
Date: Mon, 23 Sep 2019 19:37:56 +0300

> Cc: [email-masked]
> From: Christian Johansson <[email-masked]>
> Date: Mon, 23 Sep 2019 07:18:25 +0200
> 
> 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))))

This function is supposed to be used by a thread other than the one
that hit the 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.

If you want to handle the error in the thread which gets the error,
just use condition-case or similar construct in that thread.  If you
want to handle the error in another thread, thread-last-error is for
you.