Module: Howkast::Error
- Defined in:
- lib/howkast/errors.rb
Defined Under Namespace
Classes: RequestError
Class Method Summary collapse
Class Method Details
.RequestError(code, data) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/howkast/errors.rb', line 7 def self.RequestError(code, data) msg = data['response']['err']['msg'] unless data.nil? const = msg ? "#{msg.gsub(/\w+/){ $&.modulize }.gsub(/ /, '')}" : "HTTP#{code}" klass = if Howkast::Error.const_defined? const Howkast::Error.const_get const else Howkast::Error.const_set const, Class.new(RequestError) end klass.new(msg) end |