Class: DTK::RestError
- Inherits:
-
Object
- Object
- DTK::RestError
- Defined in:
- lib/errors/rest_error.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Internal, NotFound, RestUsageError
Class Method Summary collapse
Instance Method Summary collapse
- #hash_form ⇒ Object
-
#initialize(err) ⇒ RestError
constructor
A new instance of RestError.
Constructor Details
#initialize(err) ⇒ RestError
Returns a new instance of RestError.
31 32 33 34 |
# File 'lib/errors/rest_error.rb', line 31 def initialize(err) @code = nil @message = nil end |
Class Method Details
.create(err) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/errors/rest_error.rb', line 22 def self.create(err) if RestUsageError.match?(err) RestUsageError.new(err) elsif NotFound.match?(err) NotFound.new(err) else Internal.new(err) end end |
Instance Method Details
#hash_form ⇒ Object
35 36 37 |
# File 'lib/errors/rest_error.rb', line 35 def hash_form() {:code => code||:error, :message => ||''} end |