From badd4170f762a22963999ae646edfa2ef0f7d749 Mon Sep 17 00:00:00 2001 From: ksss Date: Tue, 16 Apr 2024 23:07:13 +0900 Subject: [PATCH] Add Timeout::ExitException Timeout::ExitException is an internal error. However, it can appear in Ruby code. ```rb Timeout.timeout(3) do begin long_run rescue StandardError => e logger.error(e) raise rescue Timeout::ExitException # skip logging raise end end ``` --- stdlib/timeout/0/timeout.rbs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/timeout/0/timeout.rbs b/stdlib/timeout/0/timeout.rbs index edf01dfba..61010013c 100644 --- a/stdlib/timeout/0/timeout.rbs +++ b/stdlib/timeout/0/timeout.rbs @@ -62,6 +62,12 @@ module Timeout def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T end +# +# Internal error raised to when a timeout is triggered. +# +class Timeout::ExitException < Exception +end + # # Raised by Timeout.timeout when the block times out. #