Exception: NotepadqqApi::MessageInterpreterError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/notepadqq_api/message_interpreter.rb

Defined Under Namespace

Modules: ErrorCode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code) ⇒ MessageInterpreterError

Returns a new instance of MessageInterpreterError.



131
132
133
# File 'lib/notepadqq_api/message_interpreter.rb', line 131

def initialize(error_code)
  @error_code = error_code
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



129
130
131
# File 'lib/notepadqq_api/message_interpreter.rb', line 129

def error_code
  @error_code
end

Instance Method Details

#descriptionObject



135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/notepadqq_api/message_interpreter.rb', line 135

def description
  case @error_code
    when ErrorCode::NONE then "None"
    when ErrorCode::INVALID_REQUEST then "Invalid request"
    when ErrorCode::INVALID_ARGUMENT_NUMBER then "Invalid argument number"
    when ErrorCode::INVALID_ARGUMENT_TYPE then "Invalid argument type"
    when ErrorCode::OBJECT_DEALLOCATED then "Object deallocated"
    when ErrorCode::OBJECT_NOT_FOUND then "Object not found"
    when ErrorCode::METHOD_NOT_FOUND then "Method not found"
    else "Unknown error"
  end
end