Exception: Jimson::Server::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/jimson/server/error.rb

Defined Under Namespace

Classes: ApplicationError, InternalError, InvalidParams, InvalidRequest, MethodNotFound, ParseError

Constant Summary collapse

CODES =
{
  -32700 => ParseError,
  -32600 => InvalidRequest,
  -32601 => MethodNotFound,
  -32602 => InvalidParams,
  -32603 => InternalError
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message) ⇒ Error

Returns a new instance of Error.



6
7
8
9
10
# File 'lib/jimson/server/error.rb', line 6

def initialize(code, message)
  @code = code
  @message = message
  super(message)
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/jimson/server/error.rb', line 4

def code
  @code
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/jimson/server/error.rb', line 4

def message
  @message
end

Instance Method Details

#to_hObject



12
13
14
15
16
17
# File 'lib/jimson/server/error.rb', line 12

def to_h
  {
    'code'    => @code,
    'message' => @message
  }
end