class SpookAndPay::SubmissionError

Class used to encapsulate the details of an error related to some interaction with the provider. It is generic in that it might apply to a specific part of the payload or it might capture more general details.

It will also attempt translate errors into a human readable string. Where it cannot, it still exposes the raw results from the provider allowing debugging.

Constants

ERROR_MESSAGES

A constant which defines the acceptable types of errors and which is also used to generate specific messages. Where the error is unknown, the consumer of this library will be directed to use the raw error generated by the underlying libraries.

Attributes

error_type[R]

Basic attributes

field[R]

Basic attributes

message[R]

Basic attributes

raw[R]

Basic attributes

target[R]

Basic attributes

Public Class Methods

new(target, error_type, field, raw) click to toggle source

Generates a new error. Based on the target and error type, it can generate the appropriate error messages or otherwise fall back.

@param Symbol target @param Symbol error_type @param [Symbol, nil] field @param Class raw

# File lib/spook_and_pay/submission_error.rb, line 51
def initialize(target, error_type, field, raw)
  @error_type = error_type
  @target = target
  @field = field
  @raw = raw
end

Public Instance Methods

unknown?() click to toggle source

Indicates if this is an error that we don't know anything about.

@return [true, false]

# File lib/spook_and_pay/submission_error.rb, line 61
def unknown?
  @error_type == :unknown
end