class TerraformLandscape::Error

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

@abstract

Public Class Methods

exit_status(*args) click to toggle source

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.

# File lib/terraform_landscape/errors.rb, line 13
def self.exit_status(*args)
  if args.any?
    @exit_status = args.first
  elsif @exit_status
    @exit_status
  else
    ancestors.each do |ancestor|
      return 70 if ancestor == TerraformLandscape::Error # No exit status defined
      return ancestor.exit_status if ancestor.exit_status
    end
  end
end

Public Instance Methods

exit_status() click to toggle source
# File lib/terraform_landscape/errors.rb, line 26
def exit_status
  self.class.exit_status
end