openstax_rescue_from 1.9.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d74e037eddc6542ef9b523001d60775c21c17f2
4
- data.tar.gz: 0687bd2b44e7bdc12892305047dc49f6addaa7f0
3
+ metadata.gz: 7bf24690f8a8f287e02d04f44588a5a99d9c4fd5
4
+ data.tar.gz: 4d93f369b6ae290af96973165e09cde2c3614f37
5
5
  SHA512:
6
- metadata.gz: 93b966cb0ca0df03e8bd8a8db2bbadffeca993b2f8c69fffc5992ca1aff57c3eed7433519fa6122b7422717540970e008b5db8fc92993325f79673cb984b1150
7
- data.tar.gz: 2862293642d457822bf177b7542165a93d90b53c60ef54bd07e97197cd205209b7609405cac7c47a6fc2973e10e24acc3b46c2647ba54d7e6e565707ad681041
6
+ metadata.gz: 71e70db5a362c7aebbccf785e2a377734318c95335163933cd89092485dd97e768de566f75fc3798b017be90cc05f26acff7c6a29546ca28fa54a1118192d016
7
+ data.tar.gz: 13125e2ad5c2a7dd7907e38bf8ce268afec1bd84eb78513db9419bf594fa09c3fbb829ab2391a167f181b7f2834590c6cd03241dbc0405a1ea6f91b8a06de1d5
data/.gitignore CHANGED
@@ -1,13 +1,13 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- tmp/
1
+ .bundle
2
+ .yardoc
3
+ Gemfile.lock
4
+ _yardoc
5
+ coverage
6
+ doc
7
+ pkg
8
+ spec/reports
9
+ tmp
10
10
  *.log
11
+ .byebug_history
11
12
  .DS_Store
12
13
  *~
13
- spec/dummy/db/*.sqlite3
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
1
  --color
2
+ --format documentation
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.3
data/.travis.yml CHANGED
@@ -1,19 +1,17 @@
1
+ branches:
2
+ only:
3
+ - master
1
4
  sudo: false
5
+ dist: trusty
2
6
  language: ruby
3
- rvm:
4
- - "2.2.3"
7
+ rvm: "2.2.3"
8
+ addons:
9
+ postgresql: "9.5"
5
10
  cache: bundler
6
11
  bundler_args: --retry=6
12
+ before_script:
13
+ - bundle exec rake --trace db:setup
7
14
  script:
8
- - bundle exec rake
15
+ - bundle exec rspec --format progress --tag ~type:acceptance
9
16
  notifications:
10
17
  email: false
11
- addons:
12
- postgresql: "9.5"
13
- before_install:
14
- - gem install bundler
15
- before_script:
16
- - export OXT_DB_USER=postgres
17
- - export OXT_DB_PASS=
18
- - export OXT_TEST_DB=travis_ci_test
19
- - bundle exec rake db:create:all db:migrate
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rescue_from.gemspec
4
4
  gemspec
5
+
6
+ # To use debugger
7
+ gem 'byebug'
data/README.md CHANGED
@@ -27,20 +27,13 @@ Or install it yourself as:
27
27
  Run the install generator to get the config initializer
28
28
 
29
29
  ```
30
- $ rails g open_stax:rescue_from:install
30
+ $ rails g openstax:rescue_from:install
31
31
  ```
32
32
 
33
- Declare that you want to use the openstax exception rescuer in your controller, preferably your `ApplicationController`
33
+ You can override the controller action that renders the error templates:
34
34
 
35
35
  ```ruby
36
36
  class ApplicationController < ActionController::Base
37
-
38
- # ...
39
-
40
- use_openstax_exception_rescue
41
-
42
- # ...
43
-
44
37
  # Override the rescued hook which is called when configuration.raise_exceptions is false
45
38
  # (See 'Controller hook')
46
39
  #
@@ -49,7 +42,7 @@ class ApplicationController < ActionController::Base
49
42
  # # RescueFrom.configuration private method available to you
50
43
  #
51
44
  # respond_to do |f|
52
- # f.xml { render text: "I respond strangely to the XML format!",
45
+ # f.xml { render plain: "I respond strangely to the XML format!",
53
46
  # status: exception_proxy.status }
54
47
  # end
55
48
  # end
@@ -109,6 +102,15 @@ OpenStax::RescueFrom.configure do |config|
109
102
  config.sender_address = ENV['EXCEPTION_SENDER']
110
103
  config.exception_recipients = ENV['EXCEPTION_RECIPIENTS']
111
104
  end
105
+
106
+ # Exceptions in controllers might be reraised or not depending on the settings above
107
+ ActionController::Base.use_openstax_exception_rescue
108
+
109
+ # RescueFrom always reraises background exceptions so that the background job may properly fail
110
+ ActiveJob::Base.use_openstax_exception_rescue
111
+
112
+ # URL generation errors are caused by bad routes, for example, and should not be ignored
113
+ ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationError")
112
114
  ```
113
115
 
114
116
  ## Controller hook
@@ -139,7 +141,7 @@ def openstax_exception_rescued(exception_proxy, did_notify)
139
141
  status: exception_proxy.status }
140
142
  f.json { render json: { error_id: exception_proxy.error_id }
141
143
  status: exception_proxy.status }
142
- f.all { render nothing: true, status: exception_proxy.status }
144
+ f.all { head exception_proxy.status }
143
145
  end
144
146
  end
145
147
 
data/Rakefile CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  begin
4
4
  require 'bundler/setup'
5
- rescue LoadError
5
+ rescue LoadError => exception
6
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ raise exception
7
8
  end
8
9
 
9
10
  APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
@@ -14,7 +15,7 @@ Bundler::GemHelper.install_tasks
14
15
  require 'rspec/core'
15
16
  require 'rspec/core/rake_task'
16
17
 
17
- desc "Run all specs in spec directory (excluding plugin specs)"
18
- RSpec::Core::RakeTask.new(:spec)
18
+ desc 'Run all specs in spec directory (excluding plugin specs)'
19
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
19
20
 
20
- task :default => :spec
21
+ task default: :spec
@@ -1,6 +1,6 @@
1
1
  require 'rails/generators'
2
2
 
3
- module OpenStax
3
+ module Openstax
4
4
  module RescueFrom
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  source_root File.expand_path("../templates", __FILE__)
@@ -0,0 +1,93 @@
1
+ require 'openstax_rescue_from'
2
+
3
+ OpenStax::RescueFrom.configure do |config|
4
+ config.raise_exceptions = ![false, 'false'].include?(ENV['RAISE_EXCEPTIONS']) ||
5
+ Rails.application.config.consider_all_requests_local
6
+
7
+ # config.app_name = ENV['APP_NAME']
8
+ # config.app_env = ENV['APP_ENV']
9
+ # config.contact_name = ENV['EXCEPTION_CONTACT_NAME']
10
+
11
+ # config.notifier = ExceptionNotifier
12
+
13
+ # config.html_error_template_path = 'errors/any'
14
+ # config.html_error_template_layout_name = 'application'
15
+
16
+ # config.email_prefix = "[#{app_name}] (#{app_env}) "
17
+ # config.sender_address = ENV['EXCEPTION_SENDER']
18
+ # config.exception_recipients = ENV['EXCEPTION_RECIPIENTS']
19
+ end
20
+
21
+ # Exceptions in controllers might be reraised or not depending on the settings above
22
+ ActionController::Base.use_openstax_exception_rescue
23
+
24
+ # RescueFrom always reraises background exceptions so that the background job may properly fail
25
+ ActiveJob::Base.use_openstax_exception_rescue
26
+
27
+ # URL generation errors are caused by bad routes, for example, and should not be ignored
28
+ ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationError")
29
+
30
+ # OpenStax::RescueFrom.translate_status_codes(
31
+ # internal_server_error: "Sorry, #{OpenStax::RescueFrom.configuration.app_name} had some unexpected trouble with your request.",
32
+ # not_found: 'We could not find the requested information.',
33
+ # bad_request: 'The request was unrecognized.',
34
+ # forbidden: 'You are not allowed to do that.',
35
+ # unprocessable_entity: 'Your browser asked for something that we cannot do.'
36
+ # )
37
+
38
+ # OpenStax::RescueFrom#register_exception default options:
39
+ # { notify: true, status: :internal_server_error, extras: ->(exception) { {} } }
40
+ #
41
+ # NOTE: Any unregistered exceptions rescued during run-time
42
+ # will be registered with RescueFrom with the above options
43
+ #
44
+ # Default exceptions:
45
+ #
46
+ # RescueFrom.register_exception(ActiveRecord::RecordNotFound,
47
+ # notify: false,
48
+ # status: :not_found)
49
+ #
50
+ # RescueFrom.register_exception(ActionController::RoutingError,
51
+ # notify: false,
52
+ # status: :not_found)
53
+ #
54
+ # RescueFrom.register_exception(ActionController::UnknownController,
55
+ # notify: false,
56
+ # status: :not_found)
57
+ #
58
+ # RescueFrom.register_exception(ActionController::InvalidAuthenticityToken,
59
+ # notify: false,
60
+ # status: :unprocessable_entity)
61
+ #
62
+ # RescueFrom.register_exception(AbstractController::ActionNotFound,
63
+ # notify: false,
64
+ # status: :not_found)
65
+ #
66
+ # RescueFrom.register_exception(ActionView::MissingTemplate,
67
+ # notify: false,
68
+ # status: :bad_request)
69
+ #
70
+ # RescueFrom.register_exception(ActionController::UnknownHttpMethod,
71
+ # notify: false,
72
+ # status: :bad_request)
73
+ #
74
+ # RescueFrom.register_exception(ActionController::ParameterMissing,
75
+ # notify: false,
76
+ # status: :bad_request)
77
+ #
78
+ # RescueFrom.register_exception('SecurityTransgression',
79
+ # notify: false,
80
+ # status: :forbidden)
81
+ #
82
+ # RescueFrom.register_exception('OAuth2::Error',
83
+ # extras: ->(ex) {
84
+ # {
85
+ # headers: ex.response.headers,
86
+ # status: ex.response.status,
87
+ # body: ex.response.body
88
+ # }
89
+ # })
90
+ #
91
+ # RescueFrom.register_exception('Apipie::ParamMissing',
92
+ # notify: false,
93
+ # status: :unprocessable_entity)
@@ -1,6 +1,6 @@
1
1
  require 'rails/generators'
2
2
 
3
- module OpenStax
3
+ module Openstax
4
4
  module RescueFrom
5
5
  class ViewsGenerator < Rails::Generators::Base
6
6
  source_root File.expand_path("../../../../../../app/views", __FILE__)
@@ -0,0 +1,19 @@
1
+ module OpenStax
2
+ module RescueFrom
3
+ module BackgroundJob
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def use_openstax_exception_rescue
10
+ rescue_from Exception do |exception|
11
+ RescueFrom.perform_background_rescue(exception)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ ActiveJob::Base.send :include, OpenStax::RescueFrom::BackgroundJob
@@ -28,7 +28,7 @@ module OpenStax
28
28
  f.json { render json: { error_id: did_notify ? proxy.error_id : nil },
29
29
  status: proxy.status }
30
30
 
31
- f.all { render nothing: true, status: proxy.status }
31
+ f.all { head proxy.status }
32
32
  end
33
33
  end
34
34
 
@@ -39,3 +39,5 @@ module OpenStax
39
39
  end
40
40
  end
41
41
  end
42
+
43
+ ActionController::Base.send :include, OpenStax::RescueFrom::Controller
@@ -26,6 +26,14 @@ module OpenStax
26
26
  notify: false,
27
27
  status: :bad_request)
28
28
 
29
+ RescueFrom.register_exception(ActionController::UnknownHttpMethod,
30
+ notify: false,
31
+ status: :bad_request)
32
+
33
+ RescueFrom.register_exception(ActionController::ParameterMissing,
34
+ notify: false,
35
+ status: :bad_request)
36
+
29
37
  RescueFrom.register_exception('SecurityTransgression',
30
38
  notify: false,
31
39
  status: :forbidden)
@@ -40,14 +48,6 @@ module OpenStax
40
48
  RescueFrom.register_exception('Apipie::ParamMissing',
41
49
  notify: false,
42
50
  status: :unprocessable_entity)
43
-
44
- RescueFrom.register_exception(ActionController::UnknownHttpMethod,
45
- notify: false,
46
- status: :bad_request)
47
-
48
- RescueFrom.register_exception(ActionController::ParameterMissing,
49
- notify: false,
50
- status: :bad_request)
51
51
  end
52
52
  end
53
53
  end
@@ -3,6 +3,12 @@ require 'openstax/rescue_from/default_exceptions'
3
3
  module OpenStax
4
4
  module RescueFrom
5
5
  class Engine < ::Rails::Engine
6
+ initializer 'openstax.rescue_from.inflection' do
7
+ ActiveSupport::Inflector.inflections do |inflect|
8
+ inflect.acronym 'OpenStax'
9
+ end
10
+ end
11
+
6
12
  initializer "openstax.rescue_from.use_exception_notification_middleware" do
7
13
  Rails.application.config.middleware.use ExceptionNotification::Rack, email: {
8
14
  email_prefix: RescueFrom.configuration.email_prefix,
@@ -17,11 +23,3 @@ module OpenStax
17
23
  end
18
24
  end
19
25
  end
20
-
21
- ActionController::Base.send :include, OpenStax::RescueFrom::Controller
22
-
23
- ActiveSupport::Inflector.inflections do |inflect|
24
- inflect.acronym 'OpenStax'
25
- end
26
-
27
- ActionView::Base.send :include, OpenStax::RescueFrom::ViewHelpers
@@ -1,24 +1,26 @@
1
1
  module OpenStax
2
2
  module RescueFrom
3
3
  class Logger
4
- attr_reader :proxy
4
+ attr_reader :exception_proxy, :logger
5
5
 
6
- def initialize(proxy)
7
- @proxy = proxy
6
+ def initialize(exception_proxy, logger = Rails.logger)
7
+ @exception_proxy = exception_proxy
8
+ @logger = logger
8
9
  end
9
10
 
10
11
  def record_system_error!(prefix = "An exception occurred")
11
- Rails.logger.error("#{prefix}: #{proxy.name} [#{proxy.error_id}] " +
12
- "<#{proxy.message}> #{proxy.extras}\n\n" +
13
- "#{proxy.logger_backtrace}")
12
+ logger.error("#{prefix}: #{exception_proxy.name} [#{exception_proxy.error_id}] " +
13
+ "<#{exception_proxy.message}> #{exception_proxy.extras}\n\n" +
14
+ "#{exception_proxy.logger_backtrace}")
14
15
 
15
16
  record_system_error_recursively!
16
17
  end
17
18
 
18
19
  private
19
20
  def record_system_error_recursively!
20
- if @proxy = proxy.cause
21
- RescueFrom.register_unrecognized_exception(proxy.name)
21
+ if exception_proxy.cause
22
+ RescueFrom.register_exception(exception_proxy.cause.class)
23
+ @exception_proxy = ExceptionProxy.new(exception_proxy.cause)
22
24
  record_system_error!("Exception cause")
23
25
  end
24
26
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module RescueFrom
3
- VERSION = "1.9.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -16,3 +16,5 @@ module OpenStax
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ ActionView::Base.send :include, OpenStax::RescueFrom::ViewHelpers
@@ -1,5 +1,6 @@
1
1
  require 'openstax/rescue_from/exception_options'
2
2
  require 'openstax/rescue_from/controller'
3
+ require 'openstax/rescue_from/background_job'
3
4
  require 'openstax/rescue_from/view_helpers'
4
5
  require 'openstax/rescue_from/configuration'
5
6
 
@@ -14,6 +15,14 @@ module OpenStax
14
15
  finish_exception_rescue(proxy, listener)
15
16
  end
16
17
 
18
+ def perform_background_rescue(exception)
19
+ proxy = ExceptionProxy.new(exception)
20
+ register_unrecognized_exception(proxy.name)
21
+ log_background_system_error(proxy)
22
+ send_notifying_background_exceptions(proxy)
23
+ finish_background_exception_rescue(proxy)
24
+ end
25
+
17
26
  def do_not_reraise
18
27
  original = configuration.raise_exceptions
19
28
  begin
@@ -132,6 +141,11 @@ module OpenStax
132
141
  end
133
142
  end
134
143
 
144
+ def log_background_system_error(proxy)
145
+ logger = Logger.new(proxy)
146
+ logger.record_system_error!('A background job exception occurred')
147
+ end
148
+
135
149
  def send_notifying_exceptions(proxy, listener)
136
150
  if notifies_for?(proxy.name)
137
151
  configuration.notifier.notify_exception(
@@ -151,6 +165,23 @@ module OpenStax
151
165
  end
152
166
  end
153
167
 
168
+ def send_notifying_background_exceptions(proxy)
169
+ if notifies_for?(proxy.name)
170
+ configuration.notifier.notify_exception(
171
+ proxy.exception,
172
+ data: {
173
+ error_id: proxy.error_id,
174
+ class: proxy.name,
175
+ message: proxy.message,
176
+ first_line_of_backtrace: proxy.first_backtrace_line,
177
+ cause: proxy.cause,
178
+ extras: proxy.extras
179
+ },
180
+ sections: %w(data environment backtrace)
181
+ )
182
+ end
183
+ end
184
+
154
185
  def finish_exception_rescue(proxy, listener)
155
186
  if configuration.raise_exceptions
156
187
  raise proxy.exception
@@ -158,6 +189,10 @@ module OpenStax
158
189
  listener.openstax_exception_rescued(proxy, notifies_for?(proxy.name))
159
190
  end
160
191
  end
192
+
193
+ def finish_background_exception_rescue(proxy)
194
+ raise proxy.exception
195
+ end
161
196
  end
162
197
  end
163
198
  end
@@ -9,25 +9,23 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["JP Slavinsky", "Joe Sak"]
10
10
  spec.email = ["jps@kindlinglabs.com", "joe@avant-gardelabs.com"]
11
11
 
12
- spec.summary = %q{Common exception `rescue_from` handling for OpenStax sites.}
12
+ spec.summary = "Common exception `rescue_from` handling for OpenStax sites."
13
13
  spec.homepage = "https://github.com/openstax/rescue_from"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- spec.bindir = "exe"
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/spec\//) }
17
+ spec.bindir = "bin"
18
+ spec.executables = ["console", "setup"]
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '~> 2.0'
21
+ spec.required_ruby_version = '>= 2.0'
22
22
 
23
23
  spec.add_dependency "rails", '>= 3.1', '< 6.0'
24
24
  spec.add_dependency "exception_notification", '>= 4.1', '< 5.0'
25
25
 
26
- spec.add_development_dependency "sqlite3", '~> 1.3.10'
27
- spec.add_development_dependency "bundler", "~> 1.10"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec-rails", '~> 3.3.3'
30
- spec.add_development_dependency "pry-nav", '~> 0.2.4'
31
- spec.add_development_dependency "pry-rails", '~> 0.3.4'
32
- spec.add_development_dependency "database_cleaner", '~> 1.5.0'
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "pg"
28
+ spec.add_development_dependency "rspec-rails"
29
+ spec.add_development_dependency "rails-controller-testing"
30
+ spec.add_development_dependency "database_cleaner"
33
31
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_rescue_from
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  - Joe Sak
9
9
  autorequire:
10
- bindir: exe
10
+ bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-02 00:00:00.000000000 Z
12
+ date: 2017-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -51,115 +51,89 @@ dependencies:
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '5.0'
54
- - !ruby/object:Gem::Dependency
55
- name: sqlite3
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: 1.3.10
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: 1.3.10
68
54
  - !ruby/object:Gem::Dependency
69
55
  name: bundler
70
56
  requirement: !ruby/object:Gem::Requirement
71
57
  requirements:
72
- - - "~>"
58
+ - - ">="
73
59
  - !ruby/object:Gem::Version
74
- version: '1.10'
60
+ version: '0'
75
61
  type: :development
76
62
  prerelease: false
77
63
  version_requirements: !ruby/object:Gem::Requirement
78
64
  requirements:
79
- - - "~>"
65
+ - - ">="
80
66
  - !ruby/object:Gem::Version
81
- version: '1.10'
67
+ version: '0'
82
68
  - !ruby/object:Gem::Dependency
83
- name: rake
69
+ name: pg
84
70
  requirement: !ruby/object:Gem::Requirement
85
71
  requirements:
86
- - - "~>"
72
+ - - ">="
87
73
  - !ruby/object:Gem::Version
88
- version: '10.0'
74
+ version: '0'
89
75
  type: :development
90
76
  prerelease: false
91
77
  version_requirements: !ruby/object:Gem::Requirement
92
78
  requirements:
93
- - - "~>"
79
+ - - ">="
94
80
  - !ruby/object:Gem::Version
95
- version: '10.0'
81
+ version: '0'
96
82
  - !ruby/object:Gem::Dependency
97
83
  name: rspec-rails
98
84
  requirement: !ruby/object:Gem::Requirement
99
85
  requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 3.3.3
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: 3.3.3
110
- - !ruby/object:Gem::Dependency
111
- name: pry-nav
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
86
+ - - ">="
115
87
  - !ruby/object:Gem::Version
116
- version: 0.2.4
88
+ version: '0'
117
89
  type: :development
118
90
  prerelease: false
119
91
  version_requirements: !ruby/object:Gem::Requirement
120
92
  requirements:
121
- - - "~>"
93
+ - - ">="
122
94
  - !ruby/object:Gem::Version
123
- version: 0.2.4
95
+ version: '0'
124
96
  - !ruby/object:Gem::Dependency
125
- name: pry-rails
97
+ name: rails-controller-testing
126
98
  requirement: !ruby/object:Gem::Requirement
127
99
  requirements:
128
- - - "~>"
100
+ - - ">="
129
101
  - !ruby/object:Gem::Version
130
- version: 0.3.4
102
+ version: '0'
131
103
  type: :development
132
104
  prerelease: false
133
105
  version_requirements: !ruby/object:Gem::Requirement
134
106
  requirements:
135
- - - "~>"
107
+ - - ">="
136
108
  - !ruby/object:Gem::Version
137
- version: 0.3.4
109
+ version: '0'
138
110
  - !ruby/object:Gem::Dependency
139
111
  name: database_cleaner
140
112
  requirement: !ruby/object:Gem::Requirement
141
113
  requirements:
142
- - - "~>"
114
+ - - ">="
143
115
  - !ruby/object:Gem::Version
144
- version: 1.5.0
116
+ version: '0'
145
117
  type: :development
146
118
  prerelease: false
147
119
  version_requirements: !ruby/object:Gem::Requirement
148
120
  requirements:
149
- - - "~>"
121
+ - - ">="
150
122
  - !ruby/object:Gem::Version
151
- version: 1.5.0
123
+ version: '0'
152
124
  description:
153
125
  email:
154
126
  - jps@kindlinglabs.com
155
127
  - joe@avant-gardelabs.com
156
- executables: []
128
+ executables:
129
+ - console
130
+ - setup
157
131
  extensions: []
158
132
  extra_rdoc_files: []
159
133
  files:
160
134
  - ".gitignore"
161
135
  - ".rspec"
162
- - ".ruby-gemset"
136
+ - ".ruby-version"
163
137
  - ".travis.yml"
164
138
  - Gemfile
165
139
  - LICENSE.txt
@@ -168,10 +142,11 @@ files:
168
142
  - app/views/errors/any.html.erb
169
143
  - bin/console
170
144
  - bin/setup
171
- - lib/generators/open_stax/rescue_from/install/install_generator.rb
172
- - lib/generators/open_stax/rescue_from/install/templates/rescue_from.rb
173
- - lib/generators/open_stax/rescue_from/views/views_generator.rb
145
+ - lib/generators/openstax/rescue_from/install/install_generator.rb
146
+ - lib/generators/openstax/rescue_from/install/templates/rescue_from.rb
147
+ - lib/generators/openstax/rescue_from/views/views_generator.rb
174
148
  - lib/openstax/rescue_from.rb
149
+ - lib/openstax/rescue_from/background_job.rb
175
150
  - lib/openstax/rescue_from/configuration.rb
176
151
  - lib/openstax/rescue_from/controller.rb
177
152
  - lib/openstax/rescue_from/default_exceptions.rb
@@ -195,7 +170,7 @@ require_paths:
195
170
  - lib
196
171
  required_ruby_version: !ruby/object:Gem::Requirement
197
172
  requirements:
198
- - - "~>"
173
+ - - ">="
199
174
  - !ruby/object:Gem::Version
200
175
  version: '2.0'
201
176
  required_rubygems_version: !ruby/object:Gem::Requirement
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- openstax-rescue-from
@@ -1,55 +0,0 @@
1
- require 'openstax_rescue_from'
2
-
3
- OpenStax::RescueFrom.configure do |config|
4
- config.raise_exceptions = ![false, 'false'].include?(ENV['RAISE_EXCEPTIONS']) ||
5
- Rails.application.config.consider_all_requests_local
6
-
7
- # config.app_name = ENV['APP_NAME']
8
- # config.app_env = ENV['APP_ENV']
9
- # config.contact_name = ENV['EXCEPTION_CONTACT_NAME']
10
-
11
- # config.notifier = ExceptionNotifier
12
-
13
- # config.html_error_template_path = 'errors/any'
14
- # config.html_error_template_layout_name = 'application'
15
-
16
- # config.email_prefix = "[#{app_name}] (#{app_env}) "
17
- # config.sender_address = ENV['EXCEPTION_SENDER']
18
- # config.exception_recipients = ENV['EXCEPTION_RECIPIENTS']
19
- end
20
-
21
- # OpenStax::RescueFrom#register_exception default options:
22
- #
23
- # { notify: true,
24
- # status: :internal_server_error,
25
- # extras: ->(exception) { {} } }
26
- #
27
- # NOTE: Any unregistered exceptions rescued during run-time
28
- # will be registered with RescueFrom with the above options
29
-
30
- # OpenStax::RescueFrom.register_exception('SecurityTransgression',
31
- # notify: false,
32
- # status: :forbidden)
33
- #
34
- # OpenStax::RescueFrom.register_exception(ActiveRecord::NotFound,
35
- # notify: false,
36
- # status: :not_found)
37
- #
38
- # OpenStax::RescueFrom.register_exception('OAuth2::Error',
39
- # notify: true,
40
- # extras: ->(exception) {
41
- # { headers: exception.response.headers,
42
- # status: exception.response.status,
43
- # body: exception.response.body }
44
- #
45
- # OpenStax::RescueFrom.translate_status_codes({
46
- # forbidden: "You are not allowed to access this.",
47
- # :not_found => "We couldn't find what you asked for.",
48
- # })
49
- #
50
- # Default:
51
- # - internal_server_error: "Sorry, #{OpenStax::RescueFrom.configuration.app_name} had some unexpected trouble with your request."
52
- # - not_found: 'We could not find the requested information.',
53
- # - bad_request: 'The request was unrecognized.',
54
- # - forbidden: 'You are not allowed to do that.'
55
- # - unprocessable_entity: 'Your browser asked for something that we cannot do.'