Exception: SimpleShipping::ValidationError

Inherits:
Error
  • Object
show all
Defined in:
lib/simple_shipping/exceptions.rb

Overview

Raises when some data is invalid or missing to build a request.

Instance Method Summary collapse

Constructor Details

#initialize(model_or_msg) ⇒ ValidationError

Returns a new instance of ValidationError.

Parameters:



11
12
13
14
15
16
17
18
19
20
# File 'lib/simple_shipping/exceptions.rb', line 11

def initialize(model_or_msg)
  @message = case model_or_msg
  when Abstract::Model
    "Invalid model #{model_or_msg.class}. Validation errors: #{model_or_msg.errors.full_messages.join(', ')}"
  when String
    model_or_msg
  end

  super(@message)
end