bugsnag 1.3.1 → 1.3.2
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 +4 -0
- data/README.md +9 -7
- data/VERSION +1 -1
- data/bugsnag.gemspec +2 -2
- data/lib/bugsnag/notification.rb +12 -0
- data/spec/notification_spec.rb +22 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -154,20 +154,22 @@ Rake Integration
|
|
|
154
154
|
----------------
|
|
155
155
|
|
|
156
156
|
Bugsnag can automatically notify of all exceptions that happen in your rake tasks. In order
|
|
157
|
-
to enable this, you need to `require "bugsnag/rake"
|
|
157
|
+
to enable this, you need to `require "bugsnag/rake"` in your Rakefile, like so:
|
|
158
158
|
|
|
159
159
|
```ruby
|
|
160
|
+
require File.expand_path('../config/application', __FILE__)
|
|
161
|
+
require 'rake'
|
|
160
162
|
require "bugsnag/rake"
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
puts "doing work"
|
|
165
|
-
raise "Something went wrong" # Reported to bugsnag
|
|
164
|
+
Bugsnag.configure do |config|
|
|
165
|
+
config.api_key = "YOUR_API_KEY_HERE"
|
|
166
166
|
end
|
|
167
|
+
|
|
168
|
+
YourApp::Application.load_tasks
|
|
167
169
|
```
|
|
168
170
|
|
|
169
|
-
**NOTE**:
|
|
170
|
-
|
|
171
|
+
**NOTE**: We also configure Bugsnag in the Rakefile, so the tasks that do not load the full
|
|
172
|
+
environment can still notify Bugsnag.
|
|
171
173
|
|
|
172
174
|
Standard Ruby Scripts
|
|
173
175
|
---------------------
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.2
|
data/bugsnag.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{bugsnag}
|
|
8
|
-
s.version = "1.3.
|
|
8
|
+
s.version = "1.3.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["James Smith"]
|
|
12
|
-
s.date = %q{2013-04-
|
|
12
|
+
s.date = %q{2013-04-18}
|
|
13
13
|
s.description = %q{Ruby notifier for bugsnag.com}
|
|
14
14
|
s.email = %q{james@bugsnag.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/bugsnag/notification.rb
CHANGED
|
@@ -55,6 +55,18 @@ module Bugsnag
|
|
|
55
55
|
@exceptions = []
|
|
56
56
|
ex = exception
|
|
57
57
|
while ex != nil && !@exceptions.include?(ex) && @exceptions.length < MAX_EXCEPTIONS_TO_UNWRAP
|
|
58
|
+
unless ex.is_a? Exception
|
|
59
|
+
if ex.respond_to?(:to_exception)
|
|
60
|
+
ex = ex.to_exception
|
|
61
|
+
elsif ex.respond_to?(:exception)
|
|
62
|
+
ex = ex.exception
|
|
63
|
+
end
|
|
64
|
+
unless ex.is_a? Exception
|
|
65
|
+
Bugsnag.warn("Converting non-Exception to RuntimeError: #{ex.inspect}")
|
|
66
|
+
ex = RuntimeError.new(ex.to_s)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
58
70
|
@exceptions << ex
|
|
59
71
|
|
|
60
72
|
if ex.respond_to?(:continued_exception) && ex.continued_exception
|
data/spec/notification_spec.rb
CHANGED
|
@@ -414,4 +414,26 @@ describe Bugsnag::Notification do
|
|
|
414
414
|
|
|
415
415
|
Bugsnag.notify_or_ignore(first_ex)
|
|
416
416
|
end
|
|
417
|
+
|
|
418
|
+
it "should call to_exception on i18n error objects" do
|
|
419
|
+
Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
|
|
420
|
+
exception = get_exception_from_payload(payload)
|
|
421
|
+
exception[:errorClass].should be == "I18n::MissingTranslationData"
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
I18n.exception_handler = lambda do |exception, locale, key, options|
|
|
425
|
+
Bugsnag.notify exception
|
|
426
|
+
end
|
|
427
|
+
I18n.t(:test)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
it "should generate runtimeerror for non exceptions" do
|
|
431
|
+
Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
|
|
432
|
+
exception = get_exception_from_payload(payload)
|
|
433
|
+
exception[:errorClass].should be == "RuntimeError"
|
|
434
|
+
exception[:message].should be == "test message"
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
Bugsnag.notify("test message")
|
|
438
|
+
end
|
|
417
439
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
7
|
- 3
|
|
8
|
-
-
|
|
9
|
-
version: 1.3.
|
|
8
|
+
- 2
|
|
9
|
+
version: 1.3.2
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- James Smith
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2013-04-
|
|
17
|
+
date: 2013-04-18 00:00:00 -07:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|