class Git::CommandLineError::TimeoutError
This error is raised when a git command takes longer than the configured timeout
The git command executed, status, stdout, and stderr, and the timeout duration are available from this object.
result.status.timeout? will be ‘true`
@api public
Public Class Methods
new(result, timeout_duration)
click to toggle source
Create a TimeoutError
object
@example
command = %w[sleep 10] timeout_duration = 1 status = ProcessExecuter.spawn(*command, timeout: timeout_duration) result = Git::CommandLineResult.new(command, status, 'stdout', 'err output') error = Git::TimeoutError.new(result, timeout_duration) error.error_message #=> '["sleep", "10"], status: pid 70144 SIGKILL (signal 9), stderr: "err output", timed out after 1s'
@param result [Git::CommandLineResult] the result of the git command including
the git command, status, stdout, and stderr
@param timeout_duration [Numeric] the amount of time the subprocess was allowed
to run before being killed
Calls superclass method
# File lib/git/errors.rb, line 166 def initialize(result, timeout_duration) @timeout_duration = timeout_duration super(result) end
Public Instance Methods
error_message(= <<~MESSAGE.chomp)
click to toggle source
The human readable representation of this error
@example
error.error_message #=> '["sleep", "10"], status: pid 88811 SIGKILL (signal 9), stderr: "err output", timed out after 1s'
@return [String]
# File lib/git/errors.rb, line 178 def error_message = <<~MESSAGE.chomp #{super}, timed out after #{timeout_duration}s MESSAGE # The amount of time the subprocess was allowed to run before being killed # # @example # `kill -9 $$` # set $? appropriately for this example # result = Git::CommandLineResult.new(%w[git status], $?, '', "killed") # error = Git::TimeoutError.new(result, 10) # error.timeout_duration #=> 10 # # @return [Numeric] # attr_reader :timeout_duration end