Exception: ActionKitRest::Response::ValidationError
- Inherits:
-
StandardError
- Object
- StandardError
- ActionKitRest::Response::ValidationError
- Defined in:
- lib/action_kit_rest/response/validation_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(params) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ ValidationError
Returns a new instance of ValidationError.
8 9 10 11 12 13 |
# File 'lib/action_kit_rest/response/validation_error.rb', line 8 def initialize(params) self.url = params[:url] self.body = params[:body].dup self.errors = JSON.parse(params[:body])['errors'] super() end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/action_kit_rest/response/validation_error.rb', line 6 def body @body end |
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/action_kit_rest/response/validation_error.rb', line 6 def errors @errors end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/action_kit_rest/response/validation_error.rb', line 6 def url @url end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/action_kit_rest/response/validation_error.rb', line 15 def to_s "#{super()} \n url: #{url} \n body: #{body.force_encoding('UTF-8')} \n errors: #{errors}" rescue Encoding::CompatibilityError # Something went gravely wrong trying to construct the error message, so give up on the extra info # and just raise the name of the exception. # This will let us at least raise with a backtrace. super end |