airbrake-ruby 1.0.0.rc.1 → 1.0.0

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: 92ce605f767bda511e878bfb2f3c693251573d79
4
- data.tar.gz: 996a67010b00cd651a22921befd7c1d353d1eff2
3
+ metadata.gz: 0e0b8a983d9bbd1f4b07e94bbc77e7ecc7da3149
4
+ data.tar.gz: 28e61e26cf914c6d688601fcd775291deddd5c9f
5
5
  SHA512:
6
- metadata.gz: cef747483b2c451ee12df8221bf49da0cb8faf8ccf279929be286d2070f5c6993fefdf3e82b487ba2909599f40d4baacd94db39d2e95dc8b0caeb0ea93a5cc3c
7
- data.tar.gz: 4b43779c5de8e1998760906e9816478ac71c697161d9054068b277e33bc5d831779b0b60638f3a389cb9e96482aebfa826b1083e08d64214b10d0a42854174a4
6
+ metadata.gz: 24386e09635bee179b11bb836e6440034947675d1ea509029105a28d1d8c507a5185f10949d11b58123c119530a8c7e5a4f55ebc8054a1475e2754eb4053fa8f
7
+ data.tar.gz: ffa255cceab9397485b1ca313259179768129909ae0b50ee5b9dee831fabed3ea3b954c438c9d64d315219302be0878b8192497894e29f5be08588e300bf28f3
@@ -14,7 +14,7 @@ module Airbrake
14
14
  ##
15
15
  # @return [Regexp] the pattern that matches standard Ruby stack frames,
16
16
  # such as ./spec/notice_spec.rb:43:in `block (3 levels) in <top (required)>'
17
- STACKFRAME_REGEXP = %r{\A
17
+ RUBY_STACKFRAME_REGEXP = %r{\A
18
18
  (?<file>.+) # Matches './spec/notice_spec.rb'
19
19
  :
20
20
  (?<line>\d+) # Matches '43'
@@ -34,6 +34,16 @@ module Airbrake
34
34
  \)
35
35
  \z/x
36
36
 
37
+ ##
38
+ # @return [Regexp] the template that tries to assume what a generic stack
39
+ # frame might look like, when exception's backtrace is set manually.
40
+ GENERIC_STACKFRAME_REGEXP = %r{\A
41
+ (?<file>.+) # Matches '/foo/bar/baz.ext'
42
+ :
43
+ (?<line>\d+) # Matches '43'
44
+ (?<function>) # No-op
45
+ \z}x
46
+
37
47
  ##
38
48
  # Parses an exception's backtrace.
39
49
  #
@@ -44,11 +54,11 @@ module Airbrake
44
54
  regexp = if java_exception?(exception)
45
55
  JAVA_STACKFRAME_REGEXP
46
56
  else
47
- STACKFRAME_REGEXP
57
+ RUBY_STACKFRAME_REGEXP
48
58
  end
49
59
 
50
60
  (exception.backtrace || []).map do |stackframe|
51
- stack_frame(regexp.match(stackframe))
61
+ stack_frame(match_frame(regexp, stackframe))
52
62
  end
53
63
  end
54
64
 
@@ -71,5 +81,15 @@ module Airbrake
71
81
  function: match[:function] }
72
82
  end
73
83
  end
84
+
85
+ def self.match_frame(regexp, stackframe)
86
+ match = regexp.match(stackframe)
87
+ return match if match
88
+
89
+ match = GENERIC_STACKFRAME_REGEXP.match(stackframe)
90
+ return match if match
91
+
92
+ raise Airbrake::Error, "can't parse '#{stackframe}'"
93
+ end
74
94
  end
75
95
  end
@@ -15,7 +15,7 @@ module Airbrake
15
15
  # Context tab in the dashboard
16
16
  CONTEXT = {
17
17
  os: RUBY_PLATFORM,
18
- language: RUBY_VERSION,
18
+ language: "#{RUBY_ENGINE}/#{RUBY_VERSION}".freeze,
19
19
  notifier: NOTIFIER
20
20
  }.freeze
21
21
 
@@ -3,5 +3,5 @@
3
3
  module Airbrake
4
4
  ##
5
5
  # @return [String] the library version
6
- AIRBRAKE_RUBY_VERSION = '1.0.0.rc.1'.freeze
6
+ AIRBRAKE_RUBY_VERSION = '1.0.0'.freeze
7
7
  end
@@ -73,5 +73,40 @@ RSpec.describe Airbrake::Backtrace do
73
73
  to eq(backtrace_array)
74
74
  end
75
75
  end
76
+
77
+ context "generic backtrace" do
78
+ # rubocop:disable Metrics/LineLength
79
+ let(:generic_bt) do
80
+ ["/home/bingo/bango/assets/stylesheets/error_pages.scss:139:in `animation'",
81
+ "/home/bingo/bango/assets/stylesheets/error_pages.scss:139",
82
+ "/home/bingo/.gem/ruby/2.2.2/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:349:in `block in visit_mixin'"]
83
+ end
84
+ # rubocop:enable Metrics/LineLength
85
+
86
+ let(:ex) { AirbrakeTestError.new.tap { |e| e.set_backtrace(generic_bt) } }
87
+
88
+ let(:parsed_backtrace) do
89
+ # rubocop:disable Metrics/LineLength, Style/HashSyntax, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
90
+ [{:file=>"/home/bingo/bango/assets/stylesheets/error_pages.scss", :line=>139, :function=>"animation"},
91
+ {:file=>"/home/bingo/bango/assets/stylesheets/error_pages.scss", :line=>139, :function=>""},
92
+ {:file=>"/home/bingo/.gem/ruby/2.2.2/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb", :line=>349, :function=>"block in visit_mixin"}]
93
+ # rubocop:enable Metrics/LineLength, Style/HashSyntax, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
94
+ end
95
+
96
+ it "returns a properly formatted array of hashes" do
97
+ expect(described_class.parse(ex)).to eq(parsed_backtrace)
98
+ end
99
+ end
100
+
101
+ context "unknown backtrace" do
102
+ let(:unknown_bt) { ['a b c 1 23 321 .rb'] }
103
+
104
+ let(:ex) { AirbrakeTestError.new.tap { |e| e.set_backtrace(unknown_bt) } }
105
+
106
+ it "raises error" do
107
+ expect { described_class.parse(ex) }.
108
+ to raise_error(Airbrake::Error, /can't parse/)
109
+ end
110
+ end
76
111
  end
77
112
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -135,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - ">"
138
+ - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 1.3.1
140
+ version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
143
  rubygems_version: 2.4.5