all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Johansson <christian@cvj.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37480@debbugs.gnu.org
Subject: bug#37480: 27.0.50; uncaught exception
Date: Sun, 22 Sep 2019 17:26:28 +0200	[thread overview]
Message-ID: <fded1fb5-8763-bf17-4a82-3b6cf0597191@cvj.se> (raw)
In-Reply-To: <838sqgqtam.fsf@gnu.org>

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	other threads:[~2019-09-22 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-22 14:00 bug#37480: 27.0.50; uncaught exception Christian Johansson
2019-09-22 14:50 ` Eli Zaretskii
2019-09-22 15:26   ` Christian Johansson [this message]
2019-09-22 15:39     ` Eli Zaretskii
2019-09-23  5:18       ` Christian Johansson
2019-09-23  7:14         ` Michael Albinus
2019-09-23 16:37         ` Eli Zaretskii
2019-09-24  3:16           ` Christian Johansson
2019-09-22 16:53     ` Michael Albinus
2019-11-07  4:25       ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fded1fb5-8763-bf17-4a82-3b6cf0597191@cvj.se \
    --to=christian@cvj.se \
    --cc=37480@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.