hockeybrake 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ log/*.log
8
8
  Icon?
9
9
  ehthumbs.db
10
10
  Thumbs.db
11
+ .gem
12
+ .idea/
@@ -1,23 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hockeybrake (0.0.1)
4
+ hockeybrake (0.0.4)
5
5
  airbrake (>= 3.1.2)
6
6
  multipart-post (>= 1.1.5)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activesupport (3.2.8)
12
- i18n (~> 0.6)
13
- multi_json (~> 1.0)
14
- airbrake (3.1.2)
15
- activesupport
11
+ airbrake (3.1.6)
16
12
  builder
17
- builder (3.0.0)
18
- i18n (0.6.1)
19
- multi_json (1.3.6)
13
+ girl_friday
14
+ builder (3.0.4)
15
+ connection_pool (0.9.2)
16
+ girl_friday (0.11.1)
17
+ connection_pool (~> 0.9.0)
18
+ rubinius-actor
20
19
  multipart-post (1.1.5)
20
+ rubinius-actor (0.0.2)
21
+ rubinius-core-api
22
+ rubinius-core-api (0.0.1)
21
23
 
22
24
  PLATFORMS
23
25
  ruby
data/README.md CHANGED
@@ -45,3 +45,7 @@ Resque comes with out of the box support for Airbrake. This gem is compatible wi
45
45
  * Fork the project
46
46
  * Fix the issue
47
47
  * Create pull request on github
48
+
49
+ ## More Information
50
+
51
+ * Check out the HockeyApp documentation for custom crash reports: http://support.hockeyapp.net/kb/api/api-post-custom-crashes
@@ -32,24 +32,57 @@ module HockeyBrake
32
32
 
33
33
  # parse the XML and convert them to the HockeyApp format
34
34
  begin
35
- # xml parser
36
- crashData = Hash.from_xml(data)
37
-
38
- # write the first line
39
- output += "#{crashData['notice']['error']['class']}: #{crashData['notice']['error']['message']}\n"
40
-
41
- # parse the lines
42
- lines = crashData['notice']['error']['backtrace']['line']
43
- lines.each do |line|
44
- class_name = File.basename(line['file'], ".rb").classify
45
- output += " at #{class_name}##{line['method']}(#{line['file']}:#{line['number']})\n"
35
+ if ( data.is_a?(String))
36
+ output += generate_from_xml(data)
37
+ else
38
+ output += generate_from_notice(data)
46
39
  end
47
- rescue
40
+ rescue Exception => e
48
41
  # nothing to do
42
+ output += "An exception was thrown during handling of the exception from the HockeyBrake injector\n"
43
+ output += "Exception: #{e.message}"
49
44
  end
50
45
 
51
46
  # return the output
52
47
  output
53
48
  end
49
+
50
+ def self.generate_from_notice(data)
51
+ output = ""
52
+
53
+ # write the first line
54
+ output += "#{data.error_class}: #{data.error_message}\n"
55
+
56
+ # generate the call stacke
57
+ data.backtrace.lines.each do |line|
58
+ class_name = File.basename(line.file, ".rb").classify
59
+ output += " at #{class_name}##{line.method}(#{line.file}:#{line.number})\n"
60
+ end
61
+
62
+ # emit
63
+ output
64
+ end
65
+
66
+ def self.generate_from_xml(data)
67
+ # the output
68
+ output = ""
69
+
70
+ # xml parser
71
+ crashData = Hash.from_xml(data)
72
+
73
+ # write the first line
74
+ output += "#{crashData['notice']['error']['class']}: #{crashData['notice']['error']['message']}\n"
75
+
76
+ # parse the lines
77
+ lines = crashData['notice']['error']['backtrace']['line']
78
+ lines.each do |line|
79
+ class_name = File.basename(line['file'], ".rb").classify
80
+ output += " at #{class_name}##{line['method']}(#{line['file']}:#{line['number']})\n"
81
+ end
82
+
83
+ # emit
84
+ output
85
+ end
54
86
  end
87
+
55
88
  end
@@ -1,5 +1,6 @@
1
1
  # using multipart post
2
2
  require 'net/http/post/multipart'
3
+ require 'airbrake'
3
4
 
4
5
  module HockeyBrake
5
6
  # Sends out the notice to HockeyApp
@@ -51,7 +52,7 @@ module HockeyBrake
51
52
  error_id = response.body.match(%r{<id[^>]*>(.*?)</id>})
52
53
  error_id[1] if error_id
53
54
  end
54
- rescue => e
55
+ rescue Exception => e
55
56
  log :error, "[HockeyBrake::HockeySender#send_to_airbrake] Cannot send notification. Error: #{e.class} - #{e.message}\nBacktrace:\n#{e.backtrace.join("\n\t")}"
56
57
  nil
57
58
  end
@@ -1,4 +1,4 @@
1
1
  module HockeyBrake
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hockeybrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-02 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrake