ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:69982] [Ruby trunk - Misc #11355] [Open] Exceptions inheriting from Timeout::Error should behave the same way
       [not found] <redmine.issue-11355.20150715165901@ruby-lang.org>
@ 2015-07-15 16:59 ` stefano.tortarolo
  0 siblings, 0 replies; only message in thread
From: stefano.tortarolo @ 2015-07-15 16:59 UTC (permalink / raw)
  To: ruby-core

Issue #11355 has been reported by Stefano Tortarolo.

----------------------------------------
Misc #11355: Exceptions inheriting from Timeout::Error should behave the same way
https://bugs.ruby-lang.org/issues/11355

* Author: Stefano Tortarolo
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Bug #8730 addressed a common issue when using Timeout#timeout [*], but I think that the current behaviour is at the very least surprising.

Right now, exceptions provided to Timeout#timeout are rescuable from the inner block and that applies to Timeout::Error too.
The confusing aspect is that there's no way to provide a custom exception that inherits from Timeout::Error and make it not rescuable by the inner block (i.e., #9115).

Basically what I would expect is a way to provide a custom exception that's treated calling #catch on it in Timeout#timeout

~~~
# This could be applied to every exception that inherits from Timeout::Error
# but we need a different interface to provide it, in order to maintain the behaviour that a provided exception is rescuable
bt = Error.catch(message, &bl)
~~~

I'm filing this as Misc and not Bug exactly because reading the code it's expected behaviour, so I'm mainly trying to foster a conversation about whether there's a nice way to support both scenarios.

[*] I don't speak Japanese and I cannot fully trust Google Translate, so forgive me if I lost some fundamental concepts in that thread.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-15 16:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11355.20150715165901@ruby-lang.org>
2015-07-15 16:59 ` [ruby-core:69982] [Ruby trunk - Misc #11355] [Open] Exceptions inheriting from Timeout::Error should behave the same way stefano.tortarolo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).