Exception: Smspilot::Error::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/smspilot/errors.rb

Class Method Summary collapse

Class Method Details

.get_by_code(code = nil) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/smspilot/errors.rb', line 45

def self.get_by_code(code=nil)
  if API_ERROR_CODES[code].nil?
    UnknownApiError
  else
    Smspilot::Error.const_get(API_ERROR_CODES[code])
  end
end

.raise_by_code(code = nil) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/smspilot/errors.rb', line 37

def self.raise_by_code(code=nil)
  if API_ERROR_CODES[code].nil?
    raise UnknownApiError
  else
    raise Smspilot::Error.const_get(API_ERROR_CODES[code])
  end
end