stop and display traceback when thread throws an exception

Discussion in 'Ruby' started by Ralph Shnelvar, Sep 22, 2010.

  1. [Note: parts of this message were removed to make it a legal post.]

    Is there a way to stop all threads and display traceback when any thread (especially a thread that is not the main thread) throws an exception?
     
    Ralph Shnelvar, Sep 22, 2010
    #1
    1. Advertising

  2. Ralph Shnelvar

    Quintus Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Am 22.09.2010 04:24, schrieb Ralph Shnelvar:
    > Is there a way to stop all threads and display traceback when any thread (especially a thread that is not the main thread) throws an exception?


    You can either run ruby with the -d (or --debug) switch or call this
    somewhere in your code:

    Thread.abort_on_exception = true

    Vale,
    Quintus
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.10 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAkyZtOQACgkQDYShvwAbcNmA6wCgiwr/HXLnEKqYB33KRW7qlz7U
    oPIAn3aUa9O+EQi/7XyiATJHO/F2RdvK
    =aPOP
    -----END PGP SIGNATURE-----
     
    Quintus, Sep 22, 2010
    #2
    1. Advertising

  3. Ralph Shnelvar

    elise huard Guest

    in my experience the ruby-debug debugger (1.8.7) goes all haywire when
    you're working with threads.

    On Wed, Sep 22, 2010 at 9:48 AM, Quintus <> wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > Am 22.09.2010 04:24, schrieb Ralph Shnelvar:
    >> Is there a way to stop all threads and display traceback when any thread (especially a thread that is not the main thread) throws an exception?

    >
    > You can either run ruby with the -d (or --debug) switch or call this
    > somewhere in your code:
    >
    > Thread.abort_on_exception = true
    >
    > Vale,
    > Quintus
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.10 (GNU/Linux)
    > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
    >
    > iEYEARECAAYFAkyZtOQACgkQDYShvwAbcNmA6wCgiwr/HXLnEKqYB33KRW7qlz7U
    > oPIAn3aUa9O+EQi/7XyiATJHO/F2RdvK
    > =aPOP
    > -----END PGP SIGNATURE-----
    >
    >
     
    elise huard, Sep 22, 2010
    #3
  4. [Note: parts of this message were removed to make it a legal post.]

    Quintus,

    Wednesday, September 22, 2010, 1:48:58 AM, you wrote:

    Q> -----BEGIN PGP SIGNED MESSAGE-----
    Q> Hash: SHA1

    Q> Am 22.09.2010 04:24, schrieb Ralph Shnelvar:
    >> Is there a way to stop all threads and display traceback when any thread (especially a thread that is not the main thread) throws an exception?


    Q> You can either run ruby with the -d (or --debug) switch or call this
    Q> somewhere in your code:

    Q> Thread.abort_on_exception = true

    Q> Vale,
    Q> Quintus

    That was exactly what I was looking for. Thank you!
     
    Ralph Shnelvar, Sep 22, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Miller
    Replies:
    4
    Views:
    13,440
    Chris Smith
    Nov 22, 2003
  2. Son KwonNam
    Replies:
    11
    Views:
    2,621
    mr_organic
    Apr 9, 2004
  3. Replies:
    2
    Views:
    344
  4. Edd
    Replies:
    4
    Views:
    512
  5. Jack Bates
    Replies:
    0
    Views:
    284
    Jack Bates
    May 2, 2011
Loading...

Share This Page