Class: Muddyit::Errors
- Inherits:
-
Object
- Object
- Muddyit::Errors
- Defined in:
- lib/muddyit/errors.rb
Class Method Summary collapse
-
.error_for(code, message) ⇒ Object
Method used for raising the appropriate error class for a given error code.
Class Method Details
.error_for(code, message) ⇒ Object
Method used for raising the appropriate error class for a given error code. Currently raises only Muddyit::Error
10 11 12 13 14 15 16 |
# File 'lib/muddyit/errors.rb', line 10 def self.error_for(code, ) raise RuntimeError.new("Internal error. Muddyit API error not identified or unknown error.") if (code.nil? || .nil? || .empty?) raise RuntimeError.new("Internal error. Unknown error.") if code.to_i == 0 # We assume that error code 0 is never returned e = Muddyit::Error.new("#{code}: #{}") e.code = code raise e end |