Class: Halt::Error Private

Inherits:
Object
  • Object
show all
Defined in:
lib/halt/error.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Error object to house the translation logic and exception/status information passed in when halt has been called or an exception is being rescued.

Constant Summary collapse

MESSAGES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'halt.errors.messages'.freeze
DESCRIPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'halt.errors.descriptions'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, exception: nil, message: nil, description: nil) ⇒ Error

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Error.

Parameters:

  • status (Symbol)


24
25
26
27
28
29
# File 'lib/halt/error.rb', line 24

def initialize(status, exception: nil, message: nil, description: nil)
  @status = status
  @exception = exception
  @message = message
  @description = description
end

Instance Attribute Details

#descriptionString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


37
38
39
# File 'lib/halt/error.rb', line 37

def description
  @description ||= translate DESCRIPTIONS
end

#exceptionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/halt/error.rb', line 15

def exception
  @exception
end

#messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


32
33
34
# File 'lib/halt/error.rb', line 32

def message
  @message ||= translate MESSAGES
end

#statusObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/halt/error.rb', line 14

def status
  @status
end

Instance Method Details

#attributesHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash)


42
43
44
45
46
47
48
# File 'lib/halt/error.rb', line 42

def attributes
  {
    status: status,
    message: message,
    description: description
  }
end