class GreenSMS::RestError

Attributes

code[R]
error_type[R]
params[R]

Public Class Methods

new(msg = "RestError", code = 9, params = {}) click to toggle source
Calls superclass method
# File lib/greensms/http/error.rb, line 7
def initialize(msg = "RestError", code = 9, params = {})
  @code = code
  @name = "RestError"
  @params = params
  @error_type = _get_error_type(code)
  super(msg)
end

Private Instance Methods

_get_error_type(code) click to toggle source
# File lib/greensms/http/error.rb, line 17
def _get_error_type(code)
  case code
  when 0
    return "AUTH_DECLINED"
  when 1
    return "MISSING_INPUT_PARAM"
  when 2
    return "INVALID_INPUT_PARAM"
  when 404
    return "NOT_FOUND"
  else
    return "INTERNAL_SERVER_ERROR"
  end
end