Exception: Validic::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Validic::Error
- Defined in:
- lib/validic/error.rb
Constant Summary collapse
- ClientError =
Class.new(self)
- ServerError =
Class.new(self)
Class.new(ClientError)
- NotFound =
Class.new(ClientError)
- Forbidden =
Class.new(ClientError)
- UnprocessableEntity =
Class.new(ClientError)
- Conflict =
Class.new(ClientError)
- InternalServerError =
Class.new(ServerError)
- InvalidDate =
Class.new(ClientError)
- ERRORS =
{ 401 => Validic::Error::Unauthorized, 403 => Validic::Error::Forbidden, 404 => Validic::Error::NotFound, 406 => Validic::Error::InvalidDate, 409 => Validic::Error::Conflict, 422 => Validic::Error::UnprocessableEntity, 500 => Validic::Error::InternalServerError }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = '', code = nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message = '', code = nil) ⇒ Error
Returns a new instance of Error.
30 31 32 33 |
# File 'lib/validic/error.rb', line 30 def initialize( = '', code = nil) super() @code = code end |
Class Method Details
.from_response(body) ⇒ Object
24 25 26 27 28 |
# File 'lib/validic/error.rb', line 24 def self.from_response(body) code, errors = [body['code'], body['errors']] = "#{code}: #{errors}" new() end |