Skip to content

Commit

Permalink
Add Timeout::ExitException
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
ksss committed Apr 16, 2024
1 parent e9d0491 commit badd417
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stdlib/timeout/0/timeout.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ module Timeout
def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T
end

# <!-- rdoc-file=lib/timeout.rb -->
# Internal error raised to when a timeout is triggered.
#
class Timeout::ExitException < Exception
end

# <!-- rdoc-file=lib/timeout.rb -->
# Raised by Timeout.timeout when the block times out.
#
Expand Down

0 comments on commit badd417

Please sign in to comment.