honeybadger 2.0.0.beta.9 → 2.0.0.beta.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/honeybadger/cli/helpers.rb +24 -19
- data/lib/honeybadger/notice.rb +56 -7
- data/lib/honeybadger/plugins/warden.rb +18 -0
- data/lib/honeybadger/version.rb +1 -1
- data/vendor/capistrano-honeybadger/lib/capistrano/tasks/deploy.cap +13 -7
- metadata +11 -15
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2UwNTIwYTEyMzYyMTBhZTQwYmE4MjgxMDZmOTViM2ZkYzg0MGY1Ng==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDI2Yjg0NDgyMzdiNmU0MmRiYTZiMjZiMTQ2MGE5MTEzNWMyNmNiZA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MmY4MzE2MjQzNDVlNzdhMTY3ZDkxNDk4MWI0ZWRmODdiZDA0MzllZjA2YmNm
|
10
|
+
MTVmOGY3ZmU5YjFkNmE1MmYyNjg0ZTljMDk4MjFjMTg5NmIwN2MzYWVhMDAz
|
11
|
+
MDM3MTEyYTJiMzE0ZGU2NDM1NmQ0ZjhlNmQ1MDRhYmQ4NDc0MjE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Y2RiMDRkOGMwOWY3ZDhkNmEyYmRmZDQ4NTUzMjgxNWRiM2NmMWJmN2Y2OWY1
|
14
|
+
MDVlZDYwNDE2Y2RhYjIzODViOTU4NzFkMGVmODA0OTI0YWUxMzFhYjYzZjlh
|
15
|
+
YjhlNWI1OTYzODAxNWQ4YjYxZTQxMmRlZDJlYWQ5NzZmMzRhNGI=
|
@@ -38,12 +38,7 @@ module Honeybadger
|
|
38
38
|
return false unless rails?(opts)
|
39
39
|
|
40
40
|
puts('Loading Rails environment') if opts[:verbose]
|
41
|
-
|
42
|
-
require File.expand_path('config/environment')
|
43
|
-
rescue LoadError
|
44
|
-
say('Error: could not load Rails environment. Please ensure you run this command from your project root.', :red)
|
45
|
-
exit(1)
|
46
|
-
end
|
41
|
+
::Rails.application.require_environment!
|
47
42
|
|
48
43
|
true
|
49
44
|
end
|
@@ -123,27 +118,37 @@ module Honeybadger
|
|
123
118
|
end
|
124
119
|
|
125
120
|
say('Setting up the Controller.')
|
126
|
-
|
121
|
+
eval(<<-CONTROLLER)
|
122
|
+
class Honeybadger::TestController < ApplicationController
|
127
123
|
# This is to bypass any filters that may prevent access to the action.
|
128
124
|
prepend_before_filter :test_honeybadger
|
125
|
+
|
129
126
|
def test_honeybadger
|
130
|
-
puts "Raising '#{
|
131
|
-
raise
|
127
|
+
puts "Raising '#{test_exception_class.name}' to simulate application failure."
|
128
|
+
raise #{test_exception_class}.new, 'Testing honeybadger via "honeybadger testhoneybadger test", it works.'
|
132
129
|
end
|
133
130
|
|
134
131
|
# Ensure we actually have an action to go to.
|
135
132
|
def verify; end
|
136
|
-
|
137
|
-
def exception_class
|
138
|
-
exception_name = ENV['EXCEPTION'] || 'HoneybadgerTestingException'
|
139
|
-
Object.const_get(exception_name)
|
140
|
-
rescue
|
141
|
-
Object.const_set(exception_name, Class.new(Exception))
|
142
|
-
end
|
143
133
|
end
|
144
|
-
|
145
|
-
|
146
|
-
|
134
|
+
CONTROLLER
|
135
|
+
|
136
|
+
::Rails.application.routes.tap do |r|
|
137
|
+
# RouteSet#disable_clear_and_finalize prevents existing routes from
|
138
|
+
# being cleared. We'll set it back to the original value when we're
|
139
|
+
# done so not to mess with Rails state.
|
140
|
+
d = r.disable_clear_and_finalize
|
141
|
+
begin
|
142
|
+
r.disable_clear_and_finalize = true
|
143
|
+
r.clear!
|
144
|
+
::Rails.application.routes_reloader.paths.each{ |path| load(path) }
|
145
|
+
r.draw do
|
146
|
+
match 'verify' => 'honeybadger/test#verify', :as => 'verify', :via => :get
|
147
|
+
end
|
148
|
+
::ActiveSupport.on_load(:action_controller) { r.finalize! }
|
149
|
+
ensure
|
150
|
+
r.disable_clear_and_finalize = d
|
151
|
+
end
|
147
152
|
end
|
148
153
|
|
149
154
|
say('Processing request.')
|
data/lib/honeybadger/notice.rb
CHANGED
@@ -43,6 +43,8 @@ module Honeybadger
|
|
43
43
|
cgi_data: {}.freeze
|
44
44
|
}.freeze
|
45
45
|
|
46
|
+
MAX_EXCEPTION_CAUSES = 5
|
47
|
+
|
46
48
|
class Notice
|
47
49
|
extend Forwardable
|
48
50
|
|
@@ -142,11 +144,7 @@ module Honeybadger
|
|
142
144
|
"#{exception.class.name}: #{exception.message}"
|
143
145
|
end
|
144
146
|
end
|
145
|
-
@backtrace =
|
146
|
-
exception_attribute(:backtrace, caller),
|
147
|
-
filters: construct_backtrace_filters(opts),
|
148
|
-
config: config
|
149
|
-
)
|
147
|
+
@backtrace = parse_backtrace(exception_attribute(:backtrace, caller))
|
150
148
|
@source = extract_source_from_backtrace(@backtrace, config, opts)
|
151
149
|
@fingerprint = construct_fingerprint(opts)
|
152
150
|
|
@@ -155,6 +153,8 @@ module Honeybadger
|
|
155
153
|
@request = OpenStruct.new(construct_request_hash(config.request, opts, @request_sanitizer, config.excluded_request_keys))
|
156
154
|
@context = construct_context_hash(opts, @sanitizer)
|
157
155
|
|
156
|
+
@causes = unwrap_causes(opts[:exception])
|
157
|
+
|
158
158
|
@tags = construct_tags(opts[:tags])
|
159
159
|
@tags = construct_tags(context[:tags]) | @tags if context
|
160
160
|
|
@@ -179,7 +179,8 @@ module Honeybadger
|
|
179
179
|
backtrace: backtrace,
|
180
180
|
source: source,
|
181
181
|
fingerprint: fingerprint,
|
182
|
-
tags: tags
|
182
|
+
tags: tags,
|
183
|
+
causes: causes
|
183
184
|
},
|
184
185
|
request: {
|
185
186
|
url: url,
|
@@ -233,7 +234,7 @@ module Honeybadger
|
|
233
234
|
|
234
235
|
private
|
235
236
|
|
236
|
-
attr_reader :config, :opts, :context, :stats, :api_key, :now
|
237
|
+
attr_reader :config, :opts, :context, :stats, :api_key, :now, :causes
|
237
238
|
|
238
239
|
def ignore_by_origin?
|
239
240
|
opts[:origin] == :rake && !config[:'exceptions.rescue_rake']
|
@@ -424,5 +425,53 @@ module Honeybadger
|
|
424
425
|
def send_local_variables?(config)
|
425
426
|
config[:'exceptions.local_variables']
|
426
427
|
end
|
428
|
+
|
429
|
+
# Internal: Parse Backtrace from exception backtrace.
|
430
|
+
#
|
431
|
+
# backtrace - The Array backtrace from exception.
|
432
|
+
#
|
433
|
+
# Returns the Backtrace.
|
434
|
+
def parse_backtrace(backtrace)
|
435
|
+
Backtrace.parse(
|
436
|
+
backtrace,
|
437
|
+
filters: construct_backtrace_filters(opts),
|
438
|
+
config: config
|
439
|
+
)
|
440
|
+
end
|
441
|
+
|
442
|
+
# Internal: Fetch cause from exception.
|
443
|
+
#
|
444
|
+
# exception - Exception to fetch cause from.
|
445
|
+
#
|
446
|
+
# Returns the Exception cause.
|
447
|
+
def exception_cause(exception)
|
448
|
+
e = exception
|
449
|
+
if e.respond_to?(:cause) && e.cause
|
450
|
+
e.cause
|
451
|
+
elsif e.respond_to?(:original_exception) && e.original_exception
|
452
|
+
e.original_exception
|
453
|
+
elsif e.respond_to?(:continued_exception) && e.continued_exception
|
454
|
+
e.continued_exception
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
# Internal: Unwrap causes from exception.
|
459
|
+
#
|
460
|
+
# exception - Exception to unwrap.
|
461
|
+
#
|
462
|
+
# Returns Hash causes (in payload format).
|
463
|
+
def unwrap_causes(exception)
|
464
|
+
c, e, i = [], exception, 0
|
465
|
+
while (e = exception_cause(e)) && i < MAX_EXCEPTION_CAUSES
|
466
|
+
c << {
|
467
|
+
class: e.class.name,
|
468
|
+
message: trim_size(1024) { e.message },
|
469
|
+
backtrace: parse_backtrace(e.backtrace || caller)
|
470
|
+
}
|
471
|
+
i += 1
|
472
|
+
end
|
473
|
+
|
474
|
+
c
|
475
|
+
end
|
427
476
|
end
|
428
477
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'honeybadger/plugin'
|
2
|
+
|
3
|
+
module Honeybadger
|
4
|
+
Plugin.register do
|
5
|
+
requirement { defined?(::Warden::Manager.after_set_user) }
|
6
|
+
|
7
|
+
execution do
|
8
|
+
::Warden::Manager.after_set_user do |user, auth, opts|
|
9
|
+
if user.respond_to?(:id)
|
10
|
+
::Honeybadger.context({
|
11
|
+
:user_scope => opts[:scope].to_s,
|
12
|
+
:user_id => user.id.to_s
|
13
|
+
})
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/honeybadger/version.rb
CHANGED
@@ -53,16 +53,22 @@ namespace :honeybadger do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
server = fetch(:honeybadger_server) do
|
56
|
-
s = primary(:app)
|
57
|
-
|
56
|
+
if s = primary(:app)
|
57
|
+
set(:honeybadger_server, s.select?({exclude: :no_release}) ? s : nil)
|
58
|
+
end
|
58
59
|
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
env = ["RAILS_ENV=#{rails_env}"]
|
64
|
-
::SSHKit.config.command_map.prefix[:honeybadger].unshift(*env)
|
61
|
+
unless server
|
62
|
+
run_locally do
|
63
|
+
warn 'Unable to notify Honeybadger: could not find app server for notification. Try setting honeybadger_server.'
|
65
64
|
end
|
65
|
+
next
|
66
|
+
end
|
67
|
+
|
68
|
+
on server do |host|
|
69
|
+
rails_env = fetch(:rails_env, 'production')
|
70
|
+
env = ["RAILS_ENV=#{rails_env}"]
|
71
|
+
::SSHKit.config.command_map.prefix[:honeybadger].unshift(*env)
|
66
72
|
end
|
67
73
|
end
|
68
74
|
end
|
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.10
|
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-
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/honeybadger/plugins/sidekiq.rb
|
62
62
|
- lib/honeybadger/plugins/thor.rb
|
63
63
|
- lib/honeybadger/plugins/unicorn.rb
|
64
|
+
- lib/honeybadger/plugins/warden.rb
|
64
65
|
- lib/honeybadger/rack/error_notifier.rb
|
65
66
|
- lib/honeybadger/rack/metrics_reporter.rb
|
66
67
|
- lib/honeybadger/rack/request_hash.rb
|
@@ -116,33 +117,28 @@ homepage: https://github.com/honeybadger-io/honeybadger-ruby
|
|
116
117
|
licenses:
|
117
118
|
- MIT
|
118
119
|
metadata: {}
|
119
|
-
post_install_message:
|
120
|
-
|
121
|
-
|
122
|
-
please note that there may be a few configuration changes required. Read the
|
123
|
-
upgrade instructions at:
|
124
|
-
|
125
|
-
https://www.honeybadger.io/s/gem-upgrade
|
126
|
-
|
120
|
+
post_install_message: ! "\n Thanks for installing honeybadger version 2.0! If you're
|
121
|
+
upgrading from 1.x,\n please note that there may be a few configuration changes
|
122
|
+
required. Read the\n upgrade instructions at:\n\n https://www.honeybadger.io/s/gem-upgrade\n\n"
|
127
123
|
rdoc_options:
|
128
|
-
-
|
129
|
-
-
|
124
|
+
- --markup=tomdoc
|
125
|
+
- --main=README.md
|
130
126
|
require_paths:
|
131
127
|
- lib
|
132
128
|
- vendor/capistrano-honeybadger/lib
|
133
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
130
|
requirements:
|
135
|
-
- -
|
131
|
+
- - ! '>='
|
136
132
|
- !ruby/object:Gem::Version
|
137
133
|
version: 1.9.3
|
138
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
135
|
requirements:
|
140
|
-
- -
|
136
|
+
- - ! '>'
|
141
137
|
- !ruby/object:Gem::Version
|
142
138
|
version: 1.3.1
|
143
139
|
requirements: []
|
144
140
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.4.4
|
146
142
|
signing_key:
|
147
143
|
specification_version: 4
|
148
144
|
summary: Error reports you can be happy about.
|