Exception: TSJSON::ScalarValidationError

Inherits:
ValidationError show all
Defined in:
lib/errors/scalar_validation_error.rb

Instance Method Summary collapse

Methods inherited from ValidationError

#to_json

Constructor Details

#initialize(expected_type:, received_type:, received_value:) ⇒ ScalarValidationError

Returns a new instance of ScalarValidationError.



3
4
5
# File 'lib/errors/scalar_validation_error.rb', line 3

def initialize(expected_type:, received_type:, received_value:)
  super
end

Instance Method Details

#to_human_jsonObject



7
8
9
10
11
12
13
14
# File 'lib/errors/scalar_validation_error.rb', line 7

def to_human_json
  {
    message:
      "Expected type `#{@details[:expected_type]}`. Received value `#{
        @details[:received_value]
      }` of type `#{@details[:received_type]}`"
  }
end