Exception: Msf::RPC::JSON::ServerError

Inherits:
RpcError
  • Object
show all
Defined in:
lib/msf/core/rpc/json/error.rb

Overview

Class is reserved for implementation-defined server-error exceptions.

Direct Known Subclasses

ApplicationServerError

Instance Attribute Summary

Attributes inherited from RpcError

#code, #data, #message

Instance Method Summary collapse

Methods inherited from RpcError

#to_h

Constructor Details

#initialize(code, message, data: nil) ⇒ ServerError

Instantiate a ServerError object.

Parameters:

  • code (Integer)

    A Number that indicates the error type that occurred. The code must be between -32000 and -32099.

  • message (String)

    A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.

  • data (Object) (defaults to: nil)

    A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). The default value is nil.

Raises:

  • (ArgumentError)

    Module not found (either the wrong type or name).


123
124
125
126
127
128
# File 'lib/msf/core/rpc/json/error.rb', line 123

def initialize(code, message, data: nil)
  if code < SERVER_ERROR_MIN || code > SERVER_ERROR_MAX
    raise ArgumentError.new("invalid code #{code}, must be between #{SERVER_ERROR_MAX} and #{SERVER_ERROR_MIN}")
  end
  super(code, message, data: data)
end