honeybadger 2.0.0.beta.1 → 2.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/honeybadger.rb +4 -0
- data/lib/honeybadger/init/rake.rb +65 -0
- data/lib/honeybadger/notice.rb +13 -6
- data/lib/honeybadger/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff1cb69549509f0a3ba7d723dcbed181b4f8845d
|
4
|
+
data.tar.gz: d413ed284a9b6fb3a8be8ae3c8621514cb4f4037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eba0eaf3bd4cc030b43904b0f855fbb536893faddbd095a046a4edeab8a2bfa876963e42e14dd9adcbbba00341230b11a20d2e7138128053790edc3c2133ed6c
|
7
|
+
data.tar.gz: 728b30a14a67a0f91ded6f26010fae33f8671780c3aab6ac4b57c38e16699f73f49b23bc902a308377e47a6a8866378b8f50dcbc367de9d39868c2bf2606e792
|
data/lib/honeybadger.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Patch Rake::Application to handle errors with Honeybadger
|
2
|
+
module Honeybadger
|
3
|
+
module RakeHandler
|
4
|
+
def self.included(klass)
|
5
|
+
klass.class_eval do
|
6
|
+
include Rake087Methods unless defined?(Rake::VERSION) && Rake::VERSION >= '0.9.0'
|
7
|
+
alias_method :display_error_message_without_honeybadger, :display_error_message
|
8
|
+
alias_method :display_error_message, :display_error_message_with_honeybadger
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def display_error_message_with_honeybadger(ex)
|
13
|
+
if !self.tty_output?
|
14
|
+
Honeybadger.notify_or_ignore(ex, origin: :rake, component: reconstruct_command_line)
|
15
|
+
Honeybadger.context.clear!
|
16
|
+
end
|
17
|
+
|
18
|
+
display_error_message_without_honeybadger(ex)
|
19
|
+
end
|
20
|
+
|
21
|
+
def reconstruct_command_line
|
22
|
+
"rake #{ARGV.join( ' ' )}"
|
23
|
+
end
|
24
|
+
|
25
|
+
# This module brings Rake 0.8.7 error handling to 0.9.0 standards
|
26
|
+
module Rake087Methods
|
27
|
+
# Method taken from Rake 0.9.0 source
|
28
|
+
#
|
29
|
+
# Provide standard exception handling for the given block.
|
30
|
+
def standard_exception_handling
|
31
|
+
begin
|
32
|
+
yield
|
33
|
+
rescue SystemExit => ex
|
34
|
+
# Exit silently with current status
|
35
|
+
raise
|
36
|
+
rescue OptionParser::InvalidOption => ex
|
37
|
+
$stderr.puts ex.message
|
38
|
+
exit(false)
|
39
|
+
rescue Exception => ex
|
40
|
+
# Exit with error message
|
41
|
+
display_error_message(ex)
|
42
|
+
exit(false)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Method extracted from Rake 0.8.7 source
|
47
|
+
def display_error_message(ex)
|
48
|
+
$stderr.puts "#{name} aborted!"
|
49
|
+
$stderr.puts ex.message
|
50
|
+
if options.trace
|
51
|
+
$stderr.puts ex.backtrace.join("\n")
|
52
|
+
else
|
53
|
+
$stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
|
54
|
+
$stderr.puts "(See full trace by running task with --trace)"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
Rake.application.instance_eval do
|
62
|
+
class << self
|
63
|
+
include Honeybadger::RakeHandler
|
64
|
+
end
|
65
|
+
end
|
data/lib/honeybadger/notice.rb
CHANGED
@@ -202,16 +202,23 @@ module Honeybadger
|
|
202
202
|
|
203
203
|
# Internal: Determines if this notice should be ignored
|
204
204
|
def ignore?
|
205
|
-
|
206
|
-
opts[:callbacks] &&
|
207
|
-
opts[:callbacks].exception_filter &&
|
208
|
-
opts[:callbacks].exception_filter.call(self)
|
205
|
+
ignore_by_origin? || ignore_by_class? || ignore_by_callbacks?
|
209
206
|
end
|
210
207
|
|
211
208
|
private
|
212
209
|
|
213
210
|
attr_reader :config, :opts, :context, :stats, :api_key, :now
|
214
211
|
|
212
|
+
def ignore_by_origin?
|
213
|
+
opts[:origin] == :rake && !config[:'exceptions.rescue_rake']
|
214
|
+
end
|
215
|
+
|
216
|
+
def ignore_by_callbacks?
|
217
|
+
opts[:callbacks] &&
|
218
|
+
opts[:callbacks].exception_filter &&
|
219
|
+
opts[:callbacks].exception_filter.call(self)
|
220
|
+
end
|
221
|
+
|
215
222
|
# Gets a property named "attribute" of an exception, either from
|
216
223
|
# the #args hash or actual exception (in order of precidence)
|
217
224
|
#
|
@@ -249,7 +256,7 @@ module Honeybadger
|
|
249
256
|
# ignored_class_name - The name of the ignored class. May be a
|
250
257
|
# string or regexp (optional)
|
251
258
|
#
|
252
|
-
# Returns true
|
259
|
+
# Returns true or false
|
253
260
|
def ignore_by_class?(ignored_class = nil)
|
254
261
|
@ignore_by_class ||= Proc.new do |ignored_class|
|
255
262
|
case error_class
|
@@ -260,7 +267,7 @@ module Honeybadger
|
|
260
267
|
end
|
261
268
|
end
|
262
269
|
|
263
|
-
ignored_class ? @ignore_by_class.call(ignored_class) :
|
270
|
+
ignored_class ? @ignore_by_class.call(ignored_class) : config[:'exceptions.ignore'].any?(&@ignore_by_class)
|
264
271
|
end
|
265
272
|
|
266
273
|
# Limit size of string to bytes
|
data/lib/honeybadger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeybadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Honeybadger Industries LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/honeybadger/config/yaml.rb
|
39
39
|
- lib/honeybadger/const.rb
|
40
40
|
- lib/honeybadger/init/rails.rb
|
41
|
+
- lib/honeybadger/init/rake.rb
|
41
42
|
- lib/honeybadger/init/sinatra.rb
|
42
43
|
- lib/honeybadger/logging.rb
|
43
44
|
- lib/honeybadger/notice.rb
|
@@ -120,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
121
|
requirements:
|
121
122
|
- - ">="
|
122
123
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
124
|
+
version: 1.9.3
|
124
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
126
|
requirements:
|
126
127
|
- - ">"
|