ratchetio 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ **0.5.1**
4
+ - Save the exception uuid in `env['ratchetio.exception_uuid']` for display in user-facing error pages.
5
+
3
6
  **0.5.0**
4
7
  - Add support to report exceptions raised in delayed_job.
5
8
 
9
+ **0.4.11**
10
+ - Allow exceptions with no backtrace (e.g. StandardError subclasses)
11
+
6
12
  **0.4.10**
7
13
  - Fix compatability issue with ruby 1.8
8
14
 
data/README.md CHANGED
@@ -128,11 +128,16 @@ For even more asynchrony, you can configure the gem to write to a file instead o
128
128
 
129
129
  For this to work, you'll also need to set up ratchet-agent--see its docs for details.
130
130
 
131
+ ## Using with Goalie
132
+
133
+ If you're using [Goalie](https://github.com/obvio171/goalie) for custom error pages, you may need to explicitly add `require 'goalie'` to `config/application.rb` (in addition to `require goalie/rails`) so that the monkeypatch will work. (This will be obvious if it is needed because your app won't start up: you'll see a cryptic error message about `Goalie::CustomErrorPages.render_exception` not being defined.)
134
+
131
135
 
132
136
  ## Help / Support
133
137
 
134
138
  If you run into any issues, please email us at `support@ratchet.io`
135
139
 
140
+
136
141
  ## Contributing
137
142
 
138
143
  1. Fork it
@@ -5,19 +5,29 @@ module Goalie
5
5
  private
6
6
 
7
7
  def render_exception(env, exception)
8
+ exception_data = nil
8
9
  begin
9
10
  controller = env['action_controller.instance']
10
11
  request_data = controller.try(:ratchetio_request_data)
11
12
  person_data = controller.try(:ratchetio_person_data)
12
- Ratchetio.report_exception(exception, request_data, person_data)
13
+ exception_data = Ratchetio.report_exception(exception, request_data, person_data)
13
14
  rescue => e
14
15
  # TODO use logger here?
15
16
  puts "[Ratchet.io] Exception while reporting exception to Ratchet.io: #{e}"
16
17
  end
18
+
19
+ # if an exception was reported, save uuid in the env
20
+ # so it can be displayed to the user on the error page
21
+ if exception_data
22
+ begin
23
+ env['ratchetio.exception_uuid'] = exception_data[:uuid]
24
+ rescue => e
25
+ puts "[Ratchet.io] Exception saving uuid in env: #{e}"
26
+ end
27
+ end
17
28
 
18
29
  # now continue as normal
19
30
  orig_render_exception(env, exception)
20
31
  end
21
32
  end
22
33
  end
23
-
@@ -7,16 +7,27 @@ module Ratchetio
7
7
  end
8
8
 
9
9
  def render_exception_with_ratchetio(env, exception)
10
+ exception_data = nil
10
11
  begin
11
12
  controller = env['action_controller.instance']
12
13
  request_data = controller.try(:ratchetio_request_data)
13
14
  person_data = controller.try(:ratchetio_person_data)
14
- Ratchetio.report_exception(exception, request_data, person_data)
15
+ exception_data = Ratchetio.report_exception(exception, request_data, person_data)
15
16
  rescue => e
16
17
  # TODO use logger here?
17
18
  puts "[Ratchet.io] Exception while reporting exception to Ratchet.io: #{e}"
18
19
  end
19
20
 
21
+ # if an exception was reported, save uuid in the env
22
+ # so it can be displayed to the user on the error page
23
+ if exception_data
24
+ begin
25
+ env['ratchetio.exception_uuid'] = exception_data[:uuid]
26
+ rescue => e
27
+ puts "[Ratchet.io] Exception saving uuid in env: #{e}"
28
+ end
29
+ end
30
+
20
31
  # now continue as normal
21
32
  render_exception_without_ratchetio(env, exception)
22
33
  end
@@ -1,3 +1,3 @@
1
1
  module Ratchetio
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -84,6 +84,12 @@ describe Ratchetio do
84
84
  payload["data"]["body"]["trace"]["exception"]["class"].should == "StandardError"
85
85
  payload["data"]["body"]["trace"]["exception"]["message"].should == "oops"
86
86
  end
87
+
88
+ it 'should return the exception data with a uuid' do
89
+ Ratchetio.stub(:schedule_payload) do |*args| end
90
+ exception_data = Ratchetio.report_exception(StandardError.new("oops"))
91
+ exception_data[:uuid].should_not be_nil
92
+ end
87
93
  end
88
94
 
89
95
  context 'report_message' do
@@ -97,6 +103,7 @@ describe Ratchetio do
97
103
  let(:logger_mock) { double("Rails.logger").as_null_object }
98
104
 
99
105
  it 'should report simple messages' do
106
+ logger_mock.should_receive(:info).with('[Ratchet.io] Scheduling payload')
100
107
  logger_mock.should_receive(:info).with('[Ratchet.io] Success')
101
108
  Ratchetio.report_message("Test message")
102
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratchetio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -254,4 +254,3 @@ test_files:
254
254
  - spec/ratchetio_spec.rb
255
255
  - spec/spec_helper.rb
256
256
  - spec/support/devise.rb
257
- has_rdoc: