exception_gateway 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzZiOGNjOThhZDc5MjU2NzNhNmYyNDZmYWVlMmRjNzQyNzZlZWQyNQ==
4
+ MjZlMjllYTA4NjZiYmI1YTk1ODg1MTdhOWU2MDYwZWE1NmVjODVmNg==
5
5
  data.tar.gz: !binary |-
6
- ZWM0NjE2NTNhZjZhNmM5ODUwODEwNWY5NzQ5NDE1NTYyYzc3NTFiMA==
6
+ NzRlNTJlMjhjNDNjZWM5ZDc0YmU4MGFkZWRlYzNiMmJiNTAzODNkNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Mjg0YzRlYjQ2OGU4ZjY5MGQ3YTMxYTNmM2JkNGE2MzkwOTZlMDEzMzA2N2Vl
10
- MTcyZmY5OTIzZjkwZjdjNDE2YWRmOTE5ODhiY2Q0YzUxMjBmYmQ3MjFjNTVj
11
- OThkNzYzYzU5MTdhMzFmNmY1NTkzMGRiNGI4N2EwYzBmYWE1NTc=
9
+ OTE4Y2RhYzNkMmVmY2Y5ZGM5YmY5NWUzYmYwNzEyMTYwNjU3MWIwZWM0YTQw
10
+ MjY0MTNhYTViNmIwMjUzMTdmODAwOGQwNTZhZDJjZGNjMDI3ZDVkY2QwYmJm
11
+ YjAwMTc4MjY3NmVhMzg2NmIzYzI5MzJhNDE0ZTFjZDI3ZDIwMmQ=
12
12
  data.tar.gz: !binary |-
13
- NzRhMDZhOGRmYTMxYWNlYzVhNDI3ZWNiMDc5YTdjN2MwNzI4YjY5N2I1NjM0
14
- Y2ZkMTBiZGNlNjU2Njg0YjA1NTFjMjdkMjE3YTI3OGU0ODdjODBjNTRmNGM4
15
- MTRkOGIxY2E0ZjlmOGMwYjQxOTUwNzc0MTY1NTdmZjUxYzdmNWQ=
13
+ ODQzZmRhYWViZWFiMmRlMTNiMzBlYTVjNDVkYjJlYjJjY2RmNmRlNjE0MTMy
14
+ MmU0ODcyYjg4NDA3NjkyNzFkMzMyYjE0YmNjYjQyMDM4Y2M2YmM2OGJkNDlk
15
+ YjdlMGJlMWUyMTcwZTdjODUwZGM1OTUzYTllYjQxZGI5YTBlM2E=
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # ExceptionGateway
2
2
 
3
- TODO: Write a gem description
3
+ [![Build Status](https://travis-ci.org/strikingly/exception_gateway.png)](https://travis-ci.org/strikingly/exception_gateway)
4
+
5
+ A wrapper for error reporting services. Kind of like multi_json but for exception reporting vendors. Currently only bugsnag is supported.
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,8 +20,34 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+ ### Configure the backend for error reporting, for example with bugsnag:
24
+
25
+ Bugsnag.configure do |config|
26
+ config.release_stage = ENV['RACK_ENV']
27
+ config.api_key = ENV['BUGSNAG_API_KEY']
28
+ end
29
+
30
+ ### Configure exception_gateway to use the configured backend
31
+
32
+ ExceptionGateway.configure do |config|
33
+ config.backend = :bugsnag
34
+ end
35
+
36
+ ### Use ExceptionGateway to report exception or erros:
37
+
38
+ ExceptionGateway.alert("Error!", :msg => "cannot connect to server")
39
+
40
+ begin
41
+ raise RuntimeError.new("stack overflow")
42
+ rescue Exception => e
43
+ ExceptionGateway.transmit(e)
44
+ raise
45
+ end
22
46
 
47
+ ExceptionGateway.time("roundtrip time") do
48
+ sleep 3
49
+ end
50
+
23
51
  ## Contributing
24
52
 
25
53
  1. Fork it
@@ -1,7 +1,11 @@
1
1
  module ExceptionGateway
2
2
  module Vendors
3
3
  def bugsnag_alert(msg, options={})
4
- Bugsnag.notify(RuntimeError.new(msg), {:details => options})
4
+ if ExceptionGateway.config.bugsnag_alert_api_key
5
+ Bugsnag.notify(RuntimeError.new(msg), {:details => options})
6
+ else
7
+ Bugsnag.notify(RuntimeError.new(msg), {:details => options}, api_key: ExceptionGateway.config.bugsnag_alert_api_key)
8
+ end
5
9
  end
6
10
 
7
11
  def bugsnag_transmit(exception)
@@ -1,3 +1,3 @@
1
1
  module ExceptionGateway
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -4,6 +4,7 @@ require "exception_gateway/vendors/bugsnag"
4
4
  module ExceptionGateway
5
5
  class Config
6
6
  attr_accessor :backend
7
+ attr_accessor :bugsnag_alert_api_key # configure this to enable bugsnag to log into separate project for alerts
7
8
  end
8
9
 
9
10
  class Gateway
@@ -17,6 +18,10 @@ module ExceptionGateway
17
18
  @@gateway = Gateway.new
18
19
  end
19
20
 
21
+ def self.config
22
+ @@config
23
+ end
24
+
20
25
  def self.alert(msg, options={})
21
26
  method = "#{@@config.backend}_alert".to_s
22
27
  @@gateway.send method, msg, options
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Li Zhenchao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.2.1
95
+ rubygems_version: 2.2.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: A wrapper for error reporting services, currently only bugsnag is supported