Class: Verikloak::BFF::Error

Inherits:
Error
  • Object
show all
Defined in:
lib/verikloak/bff/errors.rb

Overview

Base error class with HTTP status and short code. Inherits from Error so that rescue Verikloak::Error catches all Verikloak gem errors uniformly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code: 'bff_error', http_status: 401) ⇒ void

Build a BFF error with a stable code and HTTP status.

Parameters:

  • message (String, nil) (defaults to: nil)
  • code (String) (defaults to: 'bff_error')
  • http_status (Integer) (defaults to: 401)


23
24
25
# File 'lib/verikloak/bff/errors.rb', line 23

def initialize(message = nil, code: 'bff_error', http_status: 401)
  super(message || code, code: code, http_status: http_status)
end

Instance Attribute Details

#codeString (readonly)

Returns the current value of code.

Returns:

  • (String)

    the current value of code



16
17
18
# File 'lib/verikloak/bff/errors.rb', line 16

def code
  @code
end

#http_statusInteger (readonly)

Returns the current value of http_status.

Returns:

  • (Integer)

    the current value of http_status



16
17
18
# File 'lib/verikloak/bff/errors.rb', line 16

def http_status
  @http_status
end