class HammerCLIForemanTemplates::ExceptionHandler

Public Instance Methods

mappings() click to toggle source
Calls superclass method
# File lib/hammer_cli_foreman_templates/exception_handler.rb, line 3
def mappings
  [
    [RestClient::InternalServerError, :handle_internal_error]
  ] + super
end

Protected Instance Methods

handle_internal_error(e) click to toggle source
# File lib/hammer_cli_foreman_templates/exception_handler.rb, line 11
def handle_internal_error(e)
  handle_templates_error(e)
  HammerCLI::EX_SOFTWARE
end
handle_templates_error(e) click to toggle source
# File lib/hammer_cli_foreman_templates/exception_handler.rb, line 16
def handle_templates_error(e)
  response = JSON.parse(e.response)
  response = HammerCLIForeman.record_to_common_format(response)
  print_error(response['error'] || response['warning'])
  log_full_error e
end