appsignal 0.11.10 → 0.11.11

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.
@@ -1,3 +1,6 @@
1
+ # 0.11.11
2
+ * Reliably get errors in production for Sinatra
3
+
1
4
  # 0.11.10
2
5
  * Fix for binding bug in exceptions in Resque
3
6
  * Handle invalidly encoded characters in payload
@@ -19,6 +19,10 @@ module Appsignal
19
19
  payload[:action] = env['sinatra.route']
20
20
  end
21
21
  end
22
+ ensure
23
+ # In production newer versions of Sinatra don't raise errors, but store
24
+ # them in the sinatra.error env var.
25
+ Appsignal::Transaction.current.add_exception(env['sinatra.error']) if env['sinatra.error']
22
26
  end
23
27
 
24
28
  def raw_payload(env)
@@ -94,6 +94,7 @@ module Appsignal
94
94
 
95
95
  def add_exception(ex=nil)
96
96
  return unless ex
97
+ Appsignal.logger.debug("Adding #{ex.class.name} to transaction: #{request_id}")
97
98
  @time = Time.now.utc.to_f
98
99
  @exception = {
99
100
  :exception => ex.class.name,
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.10'
2
+ VERSION = '0.11.11'
3
3
  end
@@ -49,6 +49,19 @@ if defined?(::Sinatra)
49
49
  process_action_event.name.should == 'process_action.sinatra'
50
50
  process_action_event.payload[:action].should == 'GET /'
51
51
  end
52
+
53
+ it "should add exceptions stored in env under sinatra.error" do
54
+ exception = RuntimeError.new('Raise the roof')
55
+ env['sinatra.error'] = exception
56
+
57
+ transaction = double
58
+ transaction.stub(:set_process_action_event)
59
+ transaction.stub(:add_event)
60
+ transaction.should_receive(:add_exception).with(exception)
61
+ Appsignal::Transaction.stub(:current => transaction)
62
+
63
+ middleware.call(env)
64
+ end
52
65
  end
53
66
 
54
67
  describe "raw_payload" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.10
4
+ version: 0.11.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-05-18 00:00:00.000000000 Z
16
+ date: 2015-05-25 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rack