Exception: Judopay::ValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/judopay/error.rb

Overview

A validation error that hasn’t reached the API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, errors = nil) ⇒ ValidationError

Returns a new instance of ValidationError.



91
92
93
94
95
# File 'lib/judopay/error.rb', line 91

def initialize(message, errors = nil)
  @errors = errors
  @message = message
  @message += model_errors_summary unless @errors.nil?
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



89
90
91
# File 'lib/judopay/error.rb', line 89

def errors
  @errors
end

#messageObject

Returns the value of attribute message.



89
90
91
# File 'lib/judopay/error.rb', line 89

def message
  @message
end

Instance Method Details

#model_errorsObject



101
102
103
104
# File 'lib/judopay/error.rb', line 101

def model_errors
  return if @errors.nil?
  @errors.messages
end

#to_sObject



97
98
99
# File 'lib/judopay/error.rb', line 97

def to_s
  @message
end