Class: Toys::CLI::DefaultErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
core-docs/toys/cli.rb

Overview

Defined in the toys-core gem

A basic error handler that prints out captured errors to a stream or a logger.

Instance Method Summary collapse

Constructor Details

#initialize(output: $stderr) ⇒ DefaultErrorHandler

Create an error handler.

Parameters:

  • output (IO, nil) (defaults to: $stderr)

    Where to write errors. Default is $stderr.



397
398
399
# File 'core-docs/toys/cli.rb', line 397

def initialize(output: $stderr)
  # Source available in the toys-core gem
end

Instance Method Details

#call(error) ⇒ Integer

The error handler routine. Prints out the error message and backtrace, and returns the correct result code.

Parameters:

  • error (Exception)

    The error that occurred.

Returns:

  • (Integer)

    The result code for the execution.



408
409
410
# File 'core-docs/toys/cli.rb', line 408

def call(error)
  # Source available in the toys-core gem
end