Project

General

Profile

Actions

Feature #11650

closed

Add custom error message arg to Timeout.timeout

Added by kirs (Kir Shatrov) over 8 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:71312]

Description

Now Timeout.timeout can accept custom error message:

Timeout.timeout(30, CustomException, custom_message)

This option might be useful for networking:

# net/smtp.rb#do_start
Timeout.timeout(30, Net::OpenTimeout, "failed to open #{host}") do
  tcp_connection
end

Files

feature.diff (1.66 KB) feature.diff kirs (Kir Shatrov), 11/03/2015 10:26 AM

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Description updated (diff)

Sounds reasonable.

Updated by matz (Yukihiro Matsumoto) over 7 years ago

Accepted.

Matz.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Closed

Applied in changeset r56089.


timeout.rb: custom error message

  • lib/timeout.rb (Timeout#timeout): add custom error message
    argument. [Feature #11650]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0