Class: Contingency::Adapters::Rails::Configuration

Inherits:
Configuration
  • Object
show all
Defined in:
lib/contingency/rails/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/contingency/rails/configuration.rb', line 7

def initialize
  @errors = {
      500.to_s => [ Exception ],
      404.to_s => [
        ActiveRecord::RecordNotFound,
        ActionController::UnknownController,
        AbstractController::ActionNotFound,
        ActionController::RoutingError,
      ],
    }

  @error_messages = {
      401.to_s => [
        'Unauthorized',
        'You should log in before you try that!'
      ],
      403.to_s => [
        'Forbidden',
        'You don\'t have permission to do that.'
      ],
      404.to_s => [
        'Not Found',
        'You may have mistyped the address or the page may have moved.'
      ],
      405.to_s => [
        'Method Not Allowed',
        'You may be trying to access our API with an invalid request method.'
      ],
      406.to_s => [
        'Not Acceptable',
        'You may be trying to access our API with invalid request headers.'
      ],
      500.to_s => [
        'Internal Server Error',
        'It looks like something went wrong. Don\'t worry, we\'re on it!'
      ],
      503.to_s => [
        'Service Unavailable',
        'We\'re down for maintainence right now.'
      ],
    }

  @error_layout = 'application'
  @error_template = 'errors/error'

  @unknown_error_message = ['Server Error', 'It looks like something went wrong.']
  @failure_message =  "Server Error: It looks like something went wrong."

  @logger = ::Rails.logger
end