timber 2.1.0 → 2.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67a6b728488478b5dac3b7525be7fca8d29915b6
4
- data.tar.gz: ec34cec6ee781e3e88a7ed48749fc549785d4dc7
3
+ metadata.gz: a6efcc9b1ff96b7bfea713d3e87e36b7bfc061fd
4
+ data.tar.gz: 6ef8b32449171a85062421fc42da7c4417b7fdf8
5
5
  SHA512:
6
- metadata.gz: 33e67d6373e18bb258b2a23093a86811d9fd9a32eb81489e12283ab1b40246eb17b7dab3129ad21525f0f7b0137c104ef598adcce514516b87613fe60cfe4efd
7
- data.tar.gz: dec3368bd0670bb855d0a6bf880d8ba3c3196fb5ebeb0af79e6f0a6951522420797693d232fbabc9e801e5d255a440027c8694a3a7d5b64af8eff16257ca332b
6
+ metadata.gz: 79c590f521790d5f24349bdfb2cd9058cd78b18955bfa61164338d75b70cb7e58a24594a31f93780af6a1f27bbafd124c5a3249d3dac9d331debfb3181792e63
7
+ data.tar.gz: 6e284e8801b5e9643fe36e65200f1425c2da8ab078a6bb60f29339323da86ef371f7ca8a32634f8f7d22932672422e35bc4883e59f814ae06d131503a08ec076
@@ -41,9 +41,20 @@ module Timber
41
41
  def parse_backtrace_line(line)
42
42
  # using split for performance reasons
43
43
  file, line, function_part = line.split(":", 3)
44
- _prefix, function_pre = function_part.split("`", 2)
45
- function = Util::Object.try(function_pre, :chomp, "'")
46
- {file: file, line: line.to_i, function: function}
44
+
45
+ parsed_line = {file: file}
46
+
47
+ if line
48
+ parsed_line[:line] = line.to_i
49
+ end
50
+
51
+ if function_part
52
+ _prefix, function_pre = function_part.split("`", 2)
53
+ function = Util::Object.try(function_pre, :chomp, "'")
54
+ parsed_line[:function] = function
55
+ end
56
+
57
+ parsed_line
47
58
  end
48
59
  end
49
60
  end
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -11,5 +11,24 @@ describe Timber::Events::Exception, :rails_23 => true do
11
11
  exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
12
12
  expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86, :function=>"function2"}])
13
13
  end
14
+
15
+ it "parses valid lines" do
16
+ backtrace = [
17
+ "/path/to/file1.rb:26:in `function1'",
18
+ "path/to/file2.rb:86" # function names are optional
19
+ ]
20
+
21
+ exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
22
+ expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86}])
23
+ end
24
+
25
+ it "handles malformed lines" do
26
+ backtrace = [
27
+ "malformed"
28
+ ]
29
+
30
+ exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
31
+ expect(exception_event.backtrace).to eq([{:file=>"malformed"}])
32
+ end
14
33
  end
15
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timber Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack