openstax_rescue_from 1.8.0 → 1.9.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: 670397a8a7c60263a07415f40b98bcf9b48f9eb3
4
- data.tar.gz: 444ac6579b7266f8a56a7fb7e28d3ec9639122f0
3
+ metadata.gz: 8d74e037eddc6542ef9b523001d60775c21c17f2
4
+ data.tar.gz: 0687bd2b44e7bdc12892305047dc49f6addaa7f0
5
5
  SHA512:
6
- metadata.gz: 96fd235c11fe50267f9bf53e949630e48ccc3ccbb5df5d574085892e651f4b1c23736d47d8a1f0b82844ce4a4d046da657635e8e0ae6ec7d787bf02aa5b539a5
7
- data.tar.gz: 3b28b27ecca76ed10cffb9ed2fd9dfb8bf7b34ef007119df96cef51cbc13cc7171621c50679558640761fc5940ab56c9c2a8effdb190e7fc48719ec26deadf4b
6
+ metadata.gz: 93b966cb0ca0df03e8bd8a8db2bbadffeca993b2f8c69fffc5992ca1aff57c3eed7433519fa6122b7422717540970e008b5db8fc92993325f79673cb984b1150
7
+ data.tar.gz: 2862293642d457822bf177b7542165a93d90b53c60ef54bd07e97197cd205209b7609405cac7c47a6fc2973e10e24acc3b46c2647ba54d7e6e565707ad681041
data/.travis.yml CHANGED
@@ -9,7 +9,7 @@ script:
9
9
  notifications:
10
10
  email: false
11
11
  addons:
12
- postgresql: "9.3"
12
+ postgresql: "9.5"
13
13
  before_install:
14
14
  - gem install bundler
15
15
  before_script:
@@ -1,4 +1,5 @@
1
1
  <h3 class='rescue-from'><%= @message %></h3>
2
2
 
3
- <p class='rescue-from'>We're sorry this <%= @code %> error occurred. If you need help, please contact <%= openstax_rescue_from_contact_info %><%= " and reference error #{@error_id}" if @error_id && @did_notify %>.</p>
4
-
3
+ <% if @sorry %>
4
+ <p class='rescue-from'>We're sorry this <%= @code %> error occurred. If you need help, please contact <%= openstax_rescue_from_contact_info %><%= " and reference error #{@error_id}" if @error_id && @did_notify %>.</p>
5
+ <% end %>
@@ -17,6 +17,7 @@ module OpenStax
17
17
  @message = proxy.friendly_message
18
18
  @code = proxy.status_code
19
19
  @error_id = proxy.error_id
20
+ @sorry = proxy.sorry
20
21
  @did_notify = did_notify
21
22
 
22
23
  respond_to do |f|
@@ -1,18 +1,20 @@
1
1
  module OpenStax
2
2
  module RescueFrom
3
3
  class ExceptionOptions
4
- attr_accessor :notify, :status_code, :message, :extras
4
+ attr_accessor :notify, :status_code, :message, :sorry, :extras
5
5
 
6
6
  def initialize(options = {})
7
7
  options.stringify_keys!
8
8
  options = { 'notify' => true,
9
9
  'status' => :internal_server_error,
10
10
  'message' => nil,
11
+ 'sorry' => true,
11
12
  'extras' => ->(exception) { {} } }.merge(options)
12
13
 
13
14
  @notify = options['notify']
14
15
  @status_code = options['status']
15
16
  @message = options['message']
17
+ @sorry = options['sorry']
16
18
  @extras = options['extras']
17
19
  end
18
20
 
@@ -50,6 +50,12 @@ module OpenStax
50
50
  def status_code
51
51
  @status_code ||= RescueFrom.http_code(status)
52
52
  end
53
+
54
+ def sorry
55
+ return @sorry unless @sorry.nil?
56
+
57
+ @sorry = RescueFrom.sorry(name)
58
+ end
53
59
  end
54
60
  end
55
61
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module RescueFrom
3
- VERSION = "1.8.0"
3
+ VERSION = "1.9.0"
4
4
  end
5
5
  end
@@ -78,6 +78,10 @@ module OpenStax
78
78
  @@registered_exceptions[exception_name].status_code
79
79
  end
80
80
 
81
+ def sorry(exception_name)
82
+ @@registered_exceptions[exception_name].sorry
83
+ end
84
+
81
85
  def http_code(status)
82
86
  Rack::Utils.status_code(status)
83
87
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '~> 2.0'
22
22
 
23
- spec.add_dependency "rails", '>= 3.1', '< 5.0'
23
+ spec.add_dependency "rails", '>= 3.1', '< 6.0'
24
24
  spec.add_dependency "exception_notification", '>= 4.1', '< 5.0'
25
25
 
26
26
  spec.add_development_dependency "sqlite3", '~> 1.3.10'
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: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-01-26 00:00:00.000000000 Z
12
+ date: 2017-10-02 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: '5.0'
23
+ version: '6.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '3.1'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '6.0'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: exception_notification
36
36
  requirement: !ruby/object:Gem::Requirement