Exception: Goliath::Validation::Error

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

Overview

A information about exceptions raised during validation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, message, headers = {}) ⇒ Goliath::Validation::Error

Create a new Goliath::Validation::Error.

Examples:

raise Goliath::Validation::Error.new(401, "Invalid credentials")

Parameters:

  • status_code (Integer)

    The status code to return

  • message (String)

    The error message to return



18
19
20
21
22
# File 'lib/goliath/validation/error.rb', line 18

def initialize(status_code, message, headers = {})
  super(message)
  @status_code = status_code
  @headers = headers
end

Instance Attribute Details

#headersObject

The headers to return from the error handler



8
9
10
# File 'lib/goliath/validation/error.rb', line 8

def headers
  @headers
end

#status_codeObject

The status code to return from the error handler



6
7
8
# File 'lib/goliath/validation/error.rb', line 6

def status_code
  @status_code
end