Exception: Clickwrap::AnswerInvalid

Inherits:
CaptureRefused show all
Defined in:
lib/clickwrap/errors.rb

Overview

Raised when a required answer is missing or an answer is not one of the choices the server offered.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, statement_key: nil, reason: nil) ⇒ AnswerInvalid

Returns a new instance of AnswerInvalid.



80
81
82
83
84
# File 'lib/clickwrap/errors.rb', line 80

def initialize(message = nil, statement_key: nil, reason: nil)
  @statement_key = statement_key
  @reason = reason
  super(message || "The submitted answer for #{statement_key.inspect} was not accepted")
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



78
79
80
# File 'lib/clickwrap/errors.rb', line 78

def reason
  @reason
end

#statement_keyObject (readonly)

Returns the value of attribute statement_key.



78
79
80
# File 'lib/clickwrap/errors.rb', line 78

def statement_key
  @statement_key
end

Instance Method Details

#user_facing_messageObject



86
87
88
# File 'lib/clickwrap/errors.rb', line 86

def user_facing_message
  I18n.t("clickwrap.errors.required_statement")
end