Project

General

Profile

Actions

Misc #11355

open

Exceptions inheriting from Timeout::Error should behave the same way

Added by astratto (Stefano Tortarolo) over 9 years ago.

Status:
Open
Assignee:
-
[ruby-core:69982]

Description

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.

No data to display

Actions

Also available in: Atom PDF

Like0