Exception: Heroku::Forward::Errors::HerokuForwardError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/heroku/forward/errors/heroku_forward_error.rb

Overview

Default parent error for all custom errors. This handles the base key for the translations and provides the convenience method for translating the messages.

Generously borrowed from Mongoid.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#problemObject (readonly)

Problem occurred.



14
15
16
# File 'lib/heroku/forward/errors/heroku_forward_error.rb', line 14

def problem
  @problem
end

#resolutionObject (readonly)

Suggested problem resolution.



20
21
22
# File 'lib/heroku/forward/errors/heroku_forward_error.rb', line 20

def resolution
  @resolution
end

#summaryObject (readonly)

Summary of the problem.



17
18
19
# File 'lib/heroku/forward/errors/heroku_forward_error.rb', line 17

def summary
  @summary
end

Instance Method Details

#compose_message(key, attributes = {}) ⇒ Object

Compose the message.

Parameters

key

Lookup key in the translation table.

attributes

The objects to pass to create the message.



26
27
28
29
30
31
32
33
34
# File 'lib/heroku/forward/errors/heroku_forward_error.rb', line 26

def compose_message(key, attributes = {})
  @problem = create_problem(key, attributes)
  @summary = create_summary(key, attributes)
  @resolution = create_resolution(key, attributes)

  "\nProblem:\n  #{@problem}"+
  "\nSummary:\n  #{@summary}"+
  "\nResolution:\n  #{@resolution}"
end