class HammerCLIForemanOpenscap::ExceptionHandler

Public Instance Methods

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

Protected Instance Methods

handle_internal_error(e) click to toggle source
# File lib/hammer_cli_foreman_openscap/exception_handler.rb, line 12
def handle_internal_error(e)
  handle_scap_error(e)
  HammerCLI::EX_SOFTWARE
end
handle_scap_error(e) click to toggle source
# File lib/hammer_cli_foreman_openscap/exception_handler.rb, line 22
def handle_scap_error(e)
  response = JSON.parse(e.response)
  response = HammerCLIForeman.record_to_common_format(response)
  print_error(response["message"] || response["full_messages"])
  log_full_error e
end
handle_unprocessable_entity(e) click to toggle source
# File lib/hammer_cli_foreman_openscap/exception_handler.rb, line 17
def handle_unprocessable_entity(e)
  handle_scap_error(e)
  HammerCLI::EX_DATAERR
end