openstax_rescue_from 2.1.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/tests.yml +25 -0
- data/.gitignore +12 -9
- data/README.md +72 -11
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/lib/generators/openstax/rescue_from/install/templates/rescue_from.rb +70 -13
- data/lib/openstax/rescue_from.rb +7 -31
- data/lib/openstax/rescue_from/configuration.rb +8 -19
- data/lib/openstax/rescue_from/default_exceptions.rb +1 -1
- data/lib/openstax/rescue_from/engine.rb +10 -6
- data/lib/openstax/rescue_from/exception_proxy.rb +2 -2
- data/lib/openstax/rescue_from/version.rb +1 -1
- data/openstax_rescue_from.gemspec +4 -3
- metadata +28 -20
- data/.ruby-version +0 -1
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9163a3a8cb7a7a6baad57ca29a8d81e7ad0364babd83c49effa32a2bb9e2b3d3
|
4
|
+
data.tar.gz: 3bb60e52fa77a815c6b28b66bffcc43b6b7199d69fdf4813958710ae2f2df6c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f22d8daaf77a2e3a2aa118a329939bbe5e309ab5f30f0f6b7e72a28ee6204e6569009b47c50687bc9907f45649385369ef8e7b2fff5945c89a6767f912d2c8
|
7
|
+
data.tar.gz: b36c2d0ae5250ff5c2d302721533d80517975b9048ade2bd616fb01fd19eb09cea7c7f2c19fbb1dd79b496d3105d51e0e2c689dc9d1f65a4868b1c3fc2257e5f
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
jobs:
|
8
|
+
tests:
|
9
|
+
timeout-minutes: 30
|
10
|
+
runs-on: ubuntu-18.04
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6
|
16
|
+
- uses: actions/cache@v2
|
17
|
+
with:
|
18
|
+
path: vendor/bundle
|
19
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
20
|
+
restore-keys: |
|
21
|
+
${{ runner.os }}-gems-
|
22
|
+
- name: Setup
|
23
|
+
run: bundle install
|
24
|
+
- name: Test
|
25
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
.bundle
|
2
|
-
|
1
|
+
.bundle/
|
2
|
+
log/*.log
|
3
|
+
pkg/
|
4
|
+
spec/dummy/db/*.sqlite3
|
5
|
+
spec/dummy/log/*.log
|
6
|
+
spec/dummy/tmp/
|
7
|
+
spec/dummy/.sass-cache
|
8
|
+
*.gem
|
3
9
|
Gemfile.lock
|
4
|
-
_yardoc
|
5
|
-
coverage
|
6
|
-
doc
|
7
|
-
pkg
|
8
|
-
spec/reports
|
9
|
-
tmp
|
10
|
-
*.log
|
11
10
|
.byebug_history
|
11
|
+
|
12
|
+
# Finder
|
12
13
|
.DS_Store
|
14
|
+
|
15
|
+
# Unix temp files
|
13
16
|
*~
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# RescueFrom
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/openstax_rescue_from.svg)](http://badge.fury.io/rb/openstax_rescue_from)
|
4
|
-
[![
|
4
|
+
[![Tests](https://github.com/openstax/rescue_from/workflows/Tests/badge.svg)](https://github.com/openstax/rescue_from/actions?query=workflow:Tests)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/openstax/rescue_from/badges/gpa.svg)](https://codeclimate.com/github/openstax/rescue_from)
|
6
6
|
|
7
7
|
This is the gem that brings together disparate systems within OpenStax and abstracts consistent exception rescuing with html and json responses, and email notifying
|
@@ -89,18 +89,82 @@ OpenStax::RescueFrom.configure do |config|
|
|
89
89
|
Rails.application.config.consider_all_requests_local
|
90
90
|
|
91
91
|
config.app_name = ENV['APP_NAME']
|
92
|
-
|
92
|
+
# Can be a name, or a web/email address. See 'View helper' below
|
93
93
|
config.contact_name = ENV['EXCEPTION_CONTACT_NAME']
|
94
|
-
# can be a name, or a web/email address. See 'View helper' below
|
95
94
|
|
96
|
-
|
95
|
+
# To use ExceptionNotifier add `gem 'exception_notification'` to your Gemfile and then:
|
96
|
+
# config.notify_proc = ->(proxy, controller) do
|
97
|
+
# ExceptionNotifier.notify_exception(
|
98
|
+
# proxy.exception,
|
99
|
+
# env: controller.request.env,
|
100
|
+
# data: {
|
101
|
+
# error_id: proxy.error_id,
|
102
|
+
# class: proxy.name,
|
103
|
+
# message: proxy.message,
|
104
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
105
|
+
# cause: proxy.cause,
|
106
|
+
# dns_name: resolve_ip(controller.request.remote_ip),
|
107
|
+
# extras: proxy.extras
|
108
|
+
# },
|
109
|
+
# sections: %w(data request session environment backtrace)
|
110
|
+
# )
|
111
|
+
# end
|
112
|
+
# config.notify_background_proc = ->(proxy) do
|
113
|
+
# ExceptionNotifier.notify_exception(
|
114
|
+
# proxy.exception,
|
115
|
+
# data: {
|
116
|
+
# error_id: proxy.error_id,
|
117
|
+
# class: proxy.name,
|
118
|
+
# message: proxy.message,
|
119
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
120
|
+
# cause: proxy.cause,
|
121
|
+
# extras: proxy.extras
|
122
|
+
# },
|
123
|
+
# sections: %w(data environment backtrace)
|
124
|
+
# )
|
125
|
+
# end
|
126
|
+
# config.notify_rack_middleware = ExceptionNotification::Rack
|
127
|
+
# config.notify_rack_middleware_options = {
|
128
|
+
# email: {
|
129
|
+
# email_prefix: "[#{config.app_name}] (#{ENV['APP_ENV']}) ",
|
130
|
+
# sender_address: ENV['EXCEPTION_SENDER'],
|
131
|
+
# exception_recipients: ENV['EXCEPTION_RECIPIENTS']
|
132
|
+
# }
|
133
|
+
# }
|
134
|
+
# URL generation errors are caused by bad routes, for example, and should not be ignored
|
135
|
+
# ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationError")
|
136
|
+
|
137
|
+
# To use Raven (Sentry) add `gem 'sentry-raven', require: 'raven/base'` to your Gemfile and then:
|
138
|
+
# config.notify_proc = -> do |proxy, controller|
|
139
|
+
# extra = {
|
140
|
+
# error_id: proxy.error_id,
|
141
|
+
# class: proxy.name,
|
142
|
+
# message: proxy.message,
|
143
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
144
|
+
# cause: proxy.cause,
|
145
|
+
# dns_name: resolve_ip(controller.request.remote_ip)
|
146
|
+
# }
|
147
|
+
# extra.merge!(proxy.extras) if proxy.extras.is_a? Hash
|
148
|
+
#
|
149
|
+
# Raven.capture_exception(proxy.exception, extra: extra)
|
150
|
+
# end
|
151
|
+
# config.notify_background_proc = -> do |proxy|
|
152
|
+
# extra = {
|
153
|
+
# error_id: proxy.error_id,
|
154
|
+
# class: proxy.name,
|
155
|
+
# message: proxy.message,
|
156
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
157
|
+
# cause: proxy.cause
|
158
|
+
# }
|
159
|
+
# extra.merge!(proxy.extras) if proxy.extras.is_a? Hash
|
160
|
+
#
|
161
|
+
# Raven.capture_exception(proxy.exception, extra: extra)
|
162
|
+
# end
|
163
|
+
# require 'raven/integrations/rack'
|
164
|
+
# config.notify_rack_middleware = Raven::Rack
|
97
165
|
|
98
166
|
config.html_error_template_path = 'errors/any'
|
99
167
|
config.html_error_template_layout_name = 'application'
|
100
|
-
|
101
|
-
config.email_prefix = "[#{app_name}] (#{app_env}) "
|
102
|
-
config.sender_address = ENV['EXCEPTION_SENDER']
|
103
|
-
config.exception_recipients = ENV['EXCEPTION_RECIPIENTS']
|
104
168
|
end
|
105
169
|
|
106
170
|
# Exceptions in controllers might be reraised or not depending on the settings above
|
@@ -108,9 +172,6 @@ ActionController::Base.use_openstax_exception_rescue
|
|
108
172
|
|
109
173
|
# RescueFrom always reraises background exceptions so that the background job may properly fail
|
110
174
|
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")
|
114
175
|
```
|
115
176
|
|
116
177
|
## Controller hook
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
@@ -8,17 +8,81 @@ OpenStax::RescueFrom.configure do |config|
|
|
8
8
|
)
|
9
9
|
|
10
10
|
# config.app_name = ENV['APP_NAME']
|
11
|
-
# config.app_env = ENV['APP_ENV']
|
12
11
|
# config.contact_name = ENV['EXCEPTION_CONTACT_NAME']
|
13
12
|
|
14
|
-
#
|
13
|
+
# To use ExceptionNotifier add `gem 'exception_notification'` to your Gemfile and then:
|
14
|
+
# config.notify_proc = ->(proxy, controller) do
|
15
|
+
# ExceptionNotifier.notify_exception(
|
16
|
+
# proxy.exception,
|
17
|
+
# env: controller.request.env,
|
18
|
+
# data: {
|
19
|
+
# error_id: proxy.error_id,
|
20
|
+
# class: proxy.name,
|
21
|
+
# message: proxy.message,
|
22
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
23
|
+
# cause: proxy.cause,
|
24
|
+
# dns_name: resolve_ip(controller.request.remote_ip),
|
25
|
+
# extras: proxy.extras
|
26
|
+
# },
|
27
|
+
# sections: %w(data request session environment backtrace)
|
28
|
+
# )
|
29
|
+
# end
|
30
|
+
# config.notify_background_proc = ->(proxy) do
|
31
|
+
# ExceptionNotifier.notify_exception(
|
32
|
+
# proxy.exception,
|
33
|
+
# data: {
|
34
|
+
# error_id: proxy.error_id,
|
35
|
+
# class: proxy.name,
|
36
|
+
# message: proxy.message,
|
37
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
38
|
+
# cause: proxy.cause,
|
39
|
+
# extras: proxy.extras
|
40
|
+
# },
|
41
|
+
# sections: %w(data environment backtrace)
|
42
|
+
# )
|
43
|
+
# end
|
44
|
+
# config.notify_rack_middleware = ExceptionNotification::Rack
|
45
|
+
# config.notify_rack_middleware_options = {
|
46
|
+
# email: {
|
47
|
+
# email_prefix: "[#{config.app_name}] (#{ENV['APP_ENV']}) ",
|
48
|
+
# sender_address: ENV['EXCEPTION_SENDER'],
|
49
|
+
# exception_recipients: ENV['EXCEPTION_RECIPIENTS']
|
50
|
+
# }
|
51
|
+
# }
|
52
|
+
# URL generation errors are caused by bad routes, for example, and should not be ignored
|
53
|
+
# ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationError")
|
54
|
+
|
55
|
+
# To use Raven (Sentry) add `gem 'sentry-raven', require: 'raven/base'` to your Gemfile and then:
|
56
|
+
# config.notify_proc = -> do |proxy, controller|
|
57
|
+
# extra = {
|
58
|
+
# error_id: proxy.error_id,
|
59
|
+
# class: proxy.name,
|
60
|
+
# message: proxy.message,
|
61
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
62
|
+
# cause: proxy.cause,
|
63
|
+
# dns_name: resolve_ip(controller.request.remote_ip)
|
64
|
+
# }
|
65
|
+
# extra.merge!(proxy.extras) if proxy.extras.is_a? Hash
|
66
|
+
#
|
67
|
+
# Raven.capture_exception(proxy.exception, extra: extra)
|
68
|
+
# end
|
69
|
+
# config.notify_background_proc = -> do |proxy|
|
70
|
+
# extra = {
|
71
|
+
# error_id: proxy.error_id,
|
72
|
+
# class: proxy.name,
|
73
|
+
# message: proxy.message,
|
74
|
+
# first_line_of_backtrace: proxy.first_backtrace_line,
|
75
|
+
# cause: proxy.cause
|
76
|
+
# }
|
77
|
+
# extra.merge!(proxy.extras) if proxy.extras.is_a? Hash
|
78
|
+
#
|
79
|
+
# Raven.capture_exception(proxy.exception, extra: extra)
|
80
|
+
# end
|
81
|
+
# require 'raven/integrations/rack'
|
82
|
+
# config.notify_rack_middleware = Raven::Rack
|
15
83
|
|
16
84
|
# config.html_error_template_path = 'errors/any'
|
17
85
|
# config.html_error_template_layout_name = 'application'
|
18
|
-
|
19
|
-
# config.email_prefix = "[#{app_name}] (#{app_env}) "
|
20
|
-
# config.sender_address = ENV['EXCEPTION_SENDER']
|
21
|
-
# config.exception_recipients = ENV['EXCEPTION_RECIPIENTS']
|
22
86
|
end
|
23
87
|
|
24
88
|
# Exceptions in controllers might be reraised or not depending on the settings above
|
@@ -27,9 +91,6 @@ ActionController::Base.use_openstax_exception_rescue
|
|
27
91
|
# RescueFrom always reraises background exceptions so that the background job may properly fail
|
28
92
|
ActiveJob::Base.use_openstax_exception_rescue
|
29
93
|
|
30
|
-
# URL generation errors are caused by bad routes, for example, and should not be ignored
|
31
|
-
ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationError")
|
32
|
-
|
33
94
|
# OpenStax::RescueFrom.translate_status_codes(
|
34
95
|
# internal_server_error: "Sorry, #{OpenStax::RescueFrom.configuration.app_name} had some unexpected trouble with your request.",
|
35
96
|
# not_found: 'We could not find the requested information.',
|
@@ -54,10 +115,6 @@ ExceptionNotifier.ignored_exceptions.delete("ActionController::UrlGenerationErro
|
|
54
115
|
# notify: false,
|
55
116
|
# status: :not_found)
|
56
117
|
#
|
57
|
-
# RescueFrom.register_exception(ActionController::UnknownController,
|
58
|
-
# notify: false,
|
59
|
-
# status: :not_found)
|
60
|
-
#
|
61
118
|
# RescueFrom.register_exception(ActionController::InvalidAuthenticityToken,
|
62
119
|
# notify: false,
|
63
120
|
# status: :unprocessable_entity)
|
data/lib/openstax/rescue_from.rb
CHANGED
@@ -150,40 +150,16 @@ module OpenStax
|
|
150
150
|
logger.record_system_error!('A background job exception occurred')
|
151
151
|
end
|
152
152
|
|
153
|
-
def send_notifying_exceptions(proxy,
|
154
|
-
if notifies_for?(proxy.name)
|
155
|
-
|
156
|
-
|
157
|
-
env: listener.request.env,
|
158
|
-
data: {
|
159
|
-
error_id: proxy.error_id,
|
160
|
-
class: proxy.name,
|
161
|
-
message: proxy.message,
|
162
|
-
first_line_of_backtrace: proxy.first_backtrace_line,
|
163
|
-
cause: proxy.cause,
|
164
|
-
dns_name: resolve_ip(listener.request.remote_ip),
|
165
|
-
extras: proxy.extras
|
166
|
-
},
|
167
|
-
sections: %w(data request session environment backtrace)
|
168
|
-
)
|
169
|
-
end
|
153
|
+
def send_notifying_exceptions(proxy, controller)
|
154
|
+
return if !configuration.notify_exceptions || !notifies_for?(proxy.name)
|
155
|
+
|
156
|
+
instance_exec(proxy, controller, &configuration.notify_proc)
|
170
157
|
end
|
171
158
|
|
172
159
|
def send_notifying_background_exceptions(proxy)
|
173
|
-
if notifies_for?(proxy.name)
|
174
|
-
|
175
|
-
|
176
|
-
data: {
|
177
|
-
error_id: proxy.error_id,
|
178
|
-
class: proxy.name,
|
179
|
-
message: proxy.message,
|
180
|
-
first_line_of_backtrace: proxy.first_backtrace_line,
|
181
|
-
cause: proxy.cause,
|
182
|
-
extras: proxy.extras
|
183
|
-
},
|
184
|
-
sections: %w(data environment backtrace)
|
185
|
-
)
|
186
|
-
end
|
160
|
+
return if !configuration.notify_background_exceptions || !notifies_for?(proxy.name)
|
161
|
+
|
162
|
+
instance_exec(proxy, &configuration.notify_background_proc)
|
187
163
|
end
|
188
164
|
|
189
165
|
def finish_exception_rescue(proxy, listener)
|
@@ -1,12 +1,11 @@
|
|
1
|
-
require 'exception_notification'
|
2
|
-
|
3
1
|
module OpenStax
|
4
2
|
module RescueFrom
|
5
3
|
class Configuration
|
6
4
|
|
7
|
-
attr_accessor :raise_exceptions, :raise_background_exceptions, :
|
8
|
-
:
|
9
|
-
:
|
5
|
+
attr_accessor :raise_exceptions, :raise_background_exceptions, :notify_exceptions,
|
6
|
+
:notify_proc, :notify_background_exceptions, :notify_background_proc,
|
7
|
+
:notify_rack_middleware, :notify_rack_middleware_options,
|
8
|
+
:html_error_template_path, :html_error_template_layout_name, :app_name
|
10
9
|
|
11
10
|
attr_writer :contact_name
|
12
11
|
|
@@ -21,25 +20,15 @@ module OpenStax
|
|
21
20
|
)
|
22
21
|
|
23
22
|
@app_name = ENV['APP_NAME']
|
24
|
-
@app_env = ENV['APP_ENV']
|
25
23
|
@contact_name = ENV['EXCEPTION_CONTACT_NAME']
|
26
24
|
|
27
|
-
@
|
25
|
+
@notify_exceptions = true
|
26
|
+
@notify_proc = ->(proxy, controller) {}
|
27
|
+
@notify_background_exceptions = true
|
28
|
+
@notify_background_proc = ->(proxy) {}
|
28
29
|
|
29
30
|
@html_error_template_path = 'errors/any'
|
30
31
|
@html_error_template_layout_name = 'application'
|
31
|
-
|
32
|
-
@sender_address = ENV['EXCEPTION_SENDER']
|
33
|
-
@exception_recipients = ENV['EXCEPTION_RECIPIENTS']
|
34
|
-
end
|
35
|
-
|
36
|
-
def email_prefix
|
37
|
-
return(@email_prefix) if defined?(@email_prefix) && !@email_prefix.blank?
|
38
|
-
|
39
|
-
name = app_name.blank? ? nil : "[#{app_name}]"
|
40
|
-
env = app_env.blank? ? nil : "(#{app_env}) "
|
41
|
-
|
42
|
-
@email_prefix = [name, env].compact.join(' ')
|
43
32
|
end
|
44
33
|
end
|
45
34
|
end
|
@@ -9,12 +9,16 @@ module OpenStax
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
initializer "openstax.rescue_from.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
initializer "openstax.rescue_from.use_rack_middleware" do
|
13
|
+
middleware = OpenStax::RescueFrom.configuration.notify_rack_middleware
|
14
|
+
next if middleware.blank?
|
15
|
+
|
16
|
+
options = OpenStax::RescueFrom.configuration.notify_rack_middleware_options
|
17
|
+
if options.nil?
|
18
|
+
Rails.application.config.middleware.insert_before 0, middleware
|
19
|
+
else
|
20
|
+
Rails.application.config.middleware.insert_before 0, middleware, options
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
initializer "openstax.rescue_from.pre_register_exceptions" do
|
@@ -32,11 +32,11 @@ module OpenStax
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def logger_backtrace
|
35
|
-
@backtrace ||= exception.backtrace
|
35
|
+
@backtrace ||= exception.backtrace&.join("\n")
|
36
36
|
end
|
37
37
|
|
38
38
|
def first_backtrace_line
|
39
|
-
@first_backtrace_line ||= exception.backtrace
|
39
|
+
@first_backtrace_line ||= exception.backtrace&.first
|
40
40
|
end
|
41
41
|
|
42
42
|
def status
|
@@ -20,12 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_dependency "rails", '>= 3.1', '<
|
24
|
-
spec.add_dependency "exception_notification", '>= 4.1', '< 5.0'
|
23
|
+
spec.add_dependency "rails", '>= 3.1', '< 7.0'
|
25
24
|
|
26
25
|
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "sqlite3"
|
27
|
+
spec.add_development_dependency "listen"
|
28
28
|
spec.add_development_dependency "rspec-rails"
|
29
29
|
spec.add_development_dependency "rails-controller-testing"
|
30
30
|
spec.add_development_dependency "database_cleaner"
|
31
|
+
spec.add_development_dependency "exception_notification"
|
31
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_rescue_from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '3.1'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '7.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,29 +30,23 @@ dependencies:
|
|
30
30
|
version: '3.1'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: bundler
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '5.0'
|
44
|
-
type: :runtime
|
40
|
+
version: '0'
|
41
|
+
type: :development
|
45
42
|
prerelease: false
|
46
43
|
version_requirements: !ruby/object:Gem::Requirement
|
47
44
|
requirements:
|
48
45
|
- - ">="
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '5.0'
|
47
|
+
version: '0'
|
54
48
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
49
|
+
name: sqlite3
|
56
50
|
requirement: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - ">="
|
@@ -66,7 +60,7 @@ dependencies:
|
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: '0'
|
68
62
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
63
|
+
name: listen
|
70
64
|
requirement: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - ">="
|
@@ -121,6 +115,20 @@ dependencies:
|
|
121
115
|
- - ">="
|
122
116
|
- !ruby/object:Gem::Version
|
123
117
|
version: '0'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: exception_notification
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
124
132
|
description:
|
125
133
|
email:
|
126
134
|
- jps@kindlinglabs.com
|
@@ -131,16 +139,17 @@ executables:
|
|
131
139
|
extensions: []
|
132
140
|
extra_rdoc_files: []
|
133
141
|
files:
|
142
|
+
- ".github/workflows/tests.yml"
|
134
143
|
- ".gitignore"
|
135
144
|
- ".rspec"
|
136
|
-
- ".ruby-version"
|
137
|
-
- ".travis.yml"
|
138
145
|
- Gemfile
|
139
146
|
- LICENSE.txt
|
140
147
|
- README.md
|
141
148
|
- Rakefile
|
142
149
|
- app/views/errors/any.html.erb
|
143
150
|
- bin/console
|
151
|
+
- bin/rake
|
152
|
+
- bin/rspec
|
144
153
|
- bin/setup
|
145
154
|
- lib/generators/openstax/rescue_from/install/install_generator.rb
|
146
155
|
- lib/generators/openstax/rescue_from/install/templates/rescue_from.rb
|
@@ -179,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
188
|
- !ruby/object:Gem::Version
|
180
189
|
version: '0'
|
181
190
|
requirements: []
|
182
|
-
|
183
|
-
rubygems_version: 2.4.5.1
|
191
|
+
rubygems_version: 3.2.7
|
184
192
|
signing_key:
|
185
193
|
specification_version: 4
|
186
194
|
summary: Common exception `rescue_from` handling for OpenStax sites.
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.2.3
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
branches:
|
2
|
-
only:
|
3
|
-
- master
|
4
|
-
sudo: false
|
5
|
-
dist: trusty
|
6
|
-
language: ruby
|
7
|
-
rvm: "2.2.3"
|
8
|
-
addons:
|
9
|
-
postgresql: "9.5"
|
10
|
-
cache: bundler
|
11
|
-
bundler_args: --retry=6
|
12
|
-
before_script:
|
13
|
-
- bundle exec rake --trace db:setup
|
14
|
-
script:
|
15
|
-
- bundle exec rspec --format progress --tag ~type:acceptance
|
16
|
-
notifications:
|
17
|
-
email: false
|