Module: Fishbowl::Errors

Defined in:
lib/fishbowl/errors.rb

Defined Under Namespace

Classes: ConnectionNotEstablished, EmptyResponse, MissingHost, MissingPassword, MissingUsername, StatusError

Class Method Summary collapse

Class Method Details

.confirm_success_or_raise(code) ⇒ Object



13
14
15
# File 'lib/fishbowl/errors.rb', line 13

def self.confirm_success_or_raise(code)
  (code.to_i.eql? 1000) ? true : raise(StatusError, get_status(code))
end

.get_status(code) ⇒ Object



17
18
19
20
# File 'lib/fishbowl/errors.rb', line 17

def self.get_status(code)
  status_codes = YAML.load_file('./lib/status_codes.yml')['codes']
  status_codes[code]['message']
end