Class: Simplify::BadRequestException::FieldError

Inherits:
Object
  • Object
show all
Defined in:
lib/simplify/apiexception.rb

Overview

A single error on a field of an API request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errorData) ⇒ FieldError

Returns a new instance of FieldError.



99
100
101
102
103
# File 'lib/simplify/apiexception.rb', line 99

def initialize(errorData)
    @fieldName = errorData['field']
    @errorCode = errorData['code']
    @message = errorData['message']        
end

Instance Attribute Details

#errorCodeObject (readonly)

The code for the field error.



94
95
96
# File 'lib/simplify/apiexception.rb', line 94

def errorCode
  @errorCode
end

#fieldNameObject (readonly)

The name of the field with the error.



91
92
93
# File 'lib/simplify/apiexception.rb', line 91

def fieldName
  @fieldName
end

#messageObject (readonly)

Description of the error.



97
98
99
# File 'lib/simplify/apiexception.rb', line 97

def message
  @message
end

Instance Method Details

#to_sObject

Returns string representation of the error.



106
107
108
# File 'lib/simplify/apiexception.rb', line 106

def to_s()
    return "Field error: #{@fieldName} \"#{@message}\" (#{@errorCode})"
end