sentry-raven 0.13.0 → 0.13.1

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: c09fc2d9d439ff50aa3d575716890797ebb81cb6
4
- data.tar.gz: 834dc9c9d24c2bf004f071b9ec77d3c96edb22e7
3
+ metadata.gz: cbd5b9f37fa1ca79dea7e89151503de77596ed98
4
+ data.tar.gz: aaedca0037e5beb365920db50e7e1b0051f9e7c4
5
5
  SHA512:
6
- metadata.gz: b07c730db8e117c99f3f3e40bbf66863880bb630b2e57de211335994749a930f3f9ea4a86b49eb3f632a88c09184588c0d38b73ce9f0fb3482845c4ccfe4f904
7
- data.tar.gz: 3e3390603c2835ff88c0644c753a3459f721026adc5bb0f03e207158f65528e861363c571d6a73c7185b0f844fdfdb60190b31fe0ed6e6db3e5bcc7363e69b85
6
+ metadata.gz: c462bfc11f2cde6d33464b16b0ae3986ac62ea34a63d16f2185d4d4f5cbf1c7bf6a18228058f17d1aeefad3aa47827deba61eed49f33a2db786bfff91ff42c8f
7
+ data.tar.gz: 38266e8ad1642b99d59fcafef2c42814d09e9ebcbd8800e7a4af2040068be367ff3a4907a60df17b8f00173a9631f1d03b9381f31c6dc189e70b64bb8cb7c9f2
@@ -91,14 +91,17 @@ module Raven
91
91
  # MyApp.run
92
92
  # end
93
93
  def capture(options = {})
94
- install_at_exit_hook unless block_given?
95
- begin
96
- yield
97
- rescue Error
98
- raise # Don't capture Raven errors
99
- rescue Exception => e
100
- capture_exception(e, options)
101
- raise
94
+ if block_given?
95
+ begin
96
+ yield
97
+ rescue Error
98
+ raise # Don't capture Raven errors
99
+ rescue Exception => e
100
+ capture_exception(e, options)
101
+ raise
102
+ end
103
+ else
104
+ install_at_exit_hook(options)
102
105
  end
103
106
  end
104
107
 
@@ -215,10 +218,12 @@ module Raven
215
218
 
216
219
  private
217
220
 
218
- def install_at_exit_hook
221
+ def install_at_exit_hook(options)
219
222
  at_exit do
220
- logger.debug "Caught a post-mortem exception: #{$ERROR_INFO.inspect}"
221
- capture_exception($ERROR_INFO, options)
223
+ if $ERROR_INFO
224
+ logger.debug "Caught a post-mortem exception: #{$ERROR_INFO.inspect}"
225
+ capture_exception($ERROR_INFO, options)
226
+ end
222
227
  end
223
228
  end
224
229
  end
@@ -47,7 +47,11 @@ module Raven
47
47
  end
48
48
 
49
49
  if evt && !(evt.is_a? Thread)
50
- puts "-> event ID: #{evt.id}"
50
+ if evt.is_a? Hash
51
+ puts "-> event ID: #{evt[:event_id]}"
52
+ else
53
+ puts "-> event ID: #{evt.id}"
54
+ end
51
55
  elsif evt #async configuration
52
56
  puts "-> event ID: #{evt.value.id}"
53
57
  else
@@ -32,7 +32,7 @@ module Raven
32
32
  return
33
33
  end
34
34
 
35
- Raven.logger.debug "Sending event #{event['id']} to Sentry"
35
+ Raven.logger.debug "Sending event #{event[:event_id]} to Sentry"
36
36
 
37
37
  content_type, encoded_data = encode(event)
38
38
 
@@ -73,7 +73,7 @@ module Raven
73
73
  end
74
74
 
75
75
  def get_log_message(event)
76
- (event && event['message']) || '<no message value>'
76
+ (event && event[:message]) || '<no message value>'
77
77
  end
78
78
 
79
79
  def transport
@@ -36,19 +36,29 @@ module Raven
36
36
  def filename
37
37
  return nil if self.abs_path.nil?
38
38
 
39
- prefix = if project_root && self.abs_path.start_with?(project_root)
39
+ prefix = if under_project_root? && in_app
40
40
  project_root
41
+ elsif under_project_root?
42
+ longest_load_path || project_root
41
43
  else
42
- $LOAD_PATH.select { |s| self.abs_path.start_with?(s.to_s) }.sort_by { |s| s.to_s.length }.last
44
+ longest_load_path
43
45
  end
44
46
 
45
47
  prefix ? self.abs_path[prefix.to_s.chomp(File::SEPARATOR).length+1..-1] : self.abs_path
46
48
  end
47
49
 
50
+ def under_project_root?
51
+ project_root && abs_path.start_with?(project_root)
52
+ end
53
+
48
54
  def project_root
49
55
  @project_root ||= Raven.configuration.project_root && Raven.configuration.project_root.to_s
50
56
  end
51
57
 
58
+ def longest_load_path
59
+ $LOAD_PATH.select { |s| self.abs_path.start_with?(s.to_s) }.sort_by { |s| s.to_s.length }.last
60
+ end
61
+
52
62
  def to_hash(*args)
53
63
  data = super(*args)
54
64
  data[:filename] = self.filename
@@ -17,6 +17,7 @@ module Raven
17
17
  req.body = data
18
18
  end
19
19
  Raven.logger.warn "Error from Sentry server (#{response.status}): #{response.body}" unless response.status == 200
20
+ response
20
21
  end
21
22
 
22
23
  private
@@ -1,3 +1,3 @@
1
1
  module Raven
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubyforge_project:
166
- rubygems_version: 2.2.2
166
+ rubygems_version: 2.4.5
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: A gem that provides a client interface for the Sentry error logger