Class: Msf::WebServices::JsonRpcExceptionHandling::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/web_services/json_rpc_exception_handling.rb

Class Method Summary collapse

Class Method Details

.get_response(err, request) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/msf/core/web_services/json_rpc_exception_handling.rb', line 28

def get_response(err, request)
  parsed_request = parse_request(request)
  data = get_data(err)

  response = Msf::RPC::JSON::Dispatcher::create_error_response(
    Msf::RPC::JSON::ApplicationServerError.new(
      err,
      data: data
    ),
    parsed_request
  )

  Rack::Response.new(
    response.to_json,
    500,
    {'Content-type' => 'application/json'}
  ).finish
end