Exception: LintTrappings::LintTrappingsError Abstract

Inherits:
StandardError
  • Object
show all
Defined in:
lib/lint_trappings/errors.rb

Overview

This class is abstract.

Abstract error. Separates LintTrappings errors from other kinds of errors in the exception hierarchy.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_status(*args) ⇒ Object

Returns the status code that should be output if this error goes unhandled.

Ideally these should resemble exit codes from the sysexits documentation where it makes sense.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lint_trappings/errors.rb', line 13

def self.exit_status(*args)
  if args.any?
    @exit_status = args.first
  else
    if @exit_status
      @exit_status
    else
      ancestors[1..-1].each do |ancestor|
        return 70 if ancestor == LintTrappingsError # No exit status defined
        return ancestor.exit_status if ancestor.exit_status
      end
    end
  end
end

Instance Method Details

#exit_statusObject


28
29
30
# File 'lib/lint_trappings/errors.rb', line 28

def exit_status
  self.class.exit_status
end