exceptional 2.0.32 → 2.0.33
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.
- data/exceptional.gemspec +3 -3
- data/lib/exceptional.rb +2 -1
- data/lib/exceptional/catcher.rb +8 -0
- data/lib/exceptional/config.rb +7 -6
- data/lib/exceptional/controller_exception_data.rb +14 -7
- data/lib/exceptional/integration/dj.rb +10 -7
- data/lib/exceptional/integration/exception_middleware.rb +16 -0
- data/lib/exceptional/integration/rack.rb +4 -4
- data/lib/exceptional/integration/rack_rails.rb +5 -5
- data/lib/exceptional/integration/rake.rb +51 -0
- data/lib/exceptional/integration/tester.rb +1 -1
- data/lib/exceptional/railtie.rb +9 -1
- data/lib/exceptional/version.rb +1 -1
- data/spec/dj_integration_spec.rb +40 -18
- data/spec/exceptional/alert_exception_data_spec.rb +1 -1
- data/spec/exceptional/catcher_spec.rb +32 -8
- data/spec/exceptional/exception_data_spec.rb +8 -1
- data/spec/rails_integration_spec.rb +2 -2
- data/spec/rake_integration_spec.rb +37 -0
- data/spec/spec_helper.rb +3 -1
- metadata +41 -40
data/exceptional.gemspec
CHANGED
@@ -5,11 +5,11 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.name = %q{exceptional}
|
6
6
|
gem.version = Exceptional::VERSION
|
7
7
|
gem.authors = ["Contrast"]
|
8
|
-
gem.summary = %q{
|
9
|
-
gem.description = %q{Exceptional is the Ruby gem for communicating with http://
|
8
|
+
gem.summary = %q{ exceptional.io is a hosted service for tracking errors in your Ruby/Rails/Rack apps }
|
9
|
+
gem.description = %q{Exceptional is the Ruby gem for communicating with http://exceptional.io (hosted error tracking service). Use it to find out about errors that happen in your live app. It captures lots of helpful information to help you fix the errors.}
|
10
10
|
gem.email = %q{hello@contrast.ie}
|
11
11
|
gem.files = Dir['lib/**/*'] + Dir['spec/**/*'] + Dir['spec/**/*'] + Dir['rails/**/*'] + Dir['tasks/**/*'] + Dir['*.rb'] + ["exceptional.gemspec"]
|
12
|
-
gem.homepage = %q{http://
|
12
|
+
gem.homepage = %q{http://exceptional.io/}
|
13
13
|
gem.require_paths = ["lib"]
|
14
14
|
gem.executables << 'exceptional'
|
15
15
|
gem.rubyforge_project = %q{exceptional}
|
data/lib/exceptional.rb
CHANGED
@@ -15,6 +15,7 @@ require 'exceptional/integration/rack'
|
|
15
15
|
require 'exceptional/integration/rack_rails'
|
16
16
|
require 'exceptional/integration/alerter'
|
17
17
|
require 'exceptional/version'
|
18
|
+
require 'exceptional/integration/exception_middleware'
|
18
19
|
|
19
20
|
require 'exceptional/railtie' if defined?(Rails::Railtie)
|
20
21
|
|
@@ -67,4 +68,4 @@ module Exceptional
|
|
67
68
|
Thread.current[:exceptional_context].merge!(hash)
|
68
69
|
self
|
69
70
|
end
|
70
|
-
end
|
71
|
+
end
|
data/lib/exceptional/catcher.rb
CHANGED
@@ -5,20 +5,28 @@ module Exceptional
|
|
5
5
|
if Config.should_send_to_api?
|
6
6
|
data = ControllerExceptionData.new(exception, controller, request)
|
7
7
|
Remote.error(data)
|
8
|
+
else
|
9
|
+
raise exception
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
13
|
+
# unspeced
|
11
14
|
def handle_with_rack(exception, environment, request)
|
12
15
|
if Config.should_send_to_api?
|
13
16
|
data = RackExceptionData.new(exception, environment, request)
|
14
17
|
Remote.error(data)
|
18
|
+
else
|
19
|
+
raise exception
|
15
20
|
end
|
16
21
|
end
|
17
22
|
|
23
|
+
# unspeced
|
18
24
|
def handle(exception, name=nil)
|
19
25
|
if Config.should_send_to_api?
|
20
26
|
data = ExceptionData.new(exception, name)
|
21
27
|
Remote.error(data)
|
28
|
+
else
|
29
|
+
raise exception
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end
|
data/lib/exceptional/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'erb'
|
2
3
|
|
3
4
|
module Exceptional
|
4
5
|
class Config
|
@@ -20,16 +21,18 @@ module Exceptional
|
|
20
21
|
def load(config_file=nil)
|
21
22
|
if (config_file && File.file?(config_file))
|
22
23
|
begin
|
23
|
-
config = YAML
|
24
|
+
config = YAML.load(ERB.new(File.new(config_file).read).result)
|
24
25
|
env_config = config[application_environment] || {}
|
25
|
-
@api_key = config['api-key'] ||
|
26
|
+
@api_key = config['api-key'] ||
|
27
|
+
env_config['api-key'] ||
|
28
|
+
ENV['EXCEPTIONAL_API_KEY']
|
26
29
|
|
27
30
|
@http_proxy_host = config['http-proxy-host']
|
28
31
|
@http_proxy_port = config['http-proxy-port']
|
29
32
|
@http_proxy_username = config['http-proxy-username']
|
30
33
|
@http_proxy_password = config['http-proxy-password']
|
31
34
|
@http_open_timeout = config['http-open-timeout']
|
32
|
-
@http_read_timeout = config['http-read-timeout']
|
35
|
+
@http_read_timeout = config['http-read-timeout']
|
33
36
|
|
34
37
|
@ssl = config['ssl'] || env_config['ssl']
|
35
38
|
@enabled = env_config['enabled']
|
@@ -38,8 +41,6 @@ module Exceptional
|
|
38
41
|
rescue Exception => e
|
39
42
|
raise ConfigurationException.new("Unable to load configuration #{config_file} for environment #{application_environment} : #{e.message}")
|
40
43
|
end
|
41
|
-
else
|
42
|
-
puts "Exceptional::Config.load - no configuration file"
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -86,4 +87,4 @@ module Exceptional
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
end
|
89
|
-
end
|
90
|
+
end
|
@@ -19,7 +19,7 @@ module Exceptional
|
|
19
19
|
'url' => (@request.respond_to?(:url) ? @request.url : "#{@request.protocol}#{@request.host}#{@request.request_uri}"),
|
20
20
|
'controller' => @controller.class.to_s,
|
21
21
|
'action' => (@request.respond_to?(:parameters) ? @request.parameters['action'] : @request.params['action']),
|
22
|
-
'parameters' =>
|
22
|
+
'parameters' => filter_parameters(@request.respond_to?(:parameters) ? @request.parameters : @request.params),
|
23
23
|
'request_method' => @request.request_method.to_s,
|
24
24
|
'remote_ip' => (@request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip),
|
25
25
|
'headers' => extract_http_headers(@request.env),
|
@@ -29,23 +29,30 @@ module Exceptional
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def filter_hash(keys_to_filter, hash)
|
32
|
+
keys_to_filter.map! {|x| x.to_s}
|
32
33
|
if keys_to_filter.is_a?(Array) && !keys_to_filter.empty?
|
33
34
|
hash.each do |key, value|
|
34
|
-
if
|
35
|
-
filter_hash(keys_to_filter, hash[key])
|
36
|
-
elsif key_match?(key, keys_to_filter)
|
35
|
+
if key_match?(key, keys_to_filter)
|
37
36
|
hash[key] = "[FILTERED]"
|
37
|
+
elsif value.respond_to?(:to_hash)
|
38
|
+
filter_hash(keys_to_filter, hash[key])
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
41
42
|
hash
|
42
43
|
end
|
43
44
|
|
45
|
+
# Closer alignment to latest filtered_params:
|
46
|
+
# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/parameter_filter.rb
|
47
|
+
# https://github.com/exceptional/exceptional/issues/20
|
44
48
|
def key_match?(key, keys_to_filter)
|
45
|
-
keys_to_filter.
|
49
|
+
keys_to_filter.any? { |k|
|
50
|
+
regexp = k.is_a?(Regexp)? k : Regexp.new(k, true)
|
51
|
+
key =~ regexp
|
52
|
+
}
|
46
53
|
end
|
47
54
|
|
48
|
-
def
|
55
|
+
def filter_parameters(hash)
|
49
56
|
if @request.respond_to?(:env) && @request.env["action_dispatch.parameter_filter"]
|
50
57
|
filter_hash(@request.env["action_dispatch.parameter_filter"], hash)
|
51
58
|
elsif @controller.respond_to?(:filter_parameters)
|
@@ -55,4 +62,4 @@ module Exceptional
|
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
58
|
-
end
|
65
|
+
end
|
@@ -1,12 +1,15 @@
|
|
1
|
-
|
2
|
-
class Delayed::
|
3
|
-
def
|
4
|
-
Exceptional.handle(e, "Delayed::Job #{
|
5
|
-
|
1
|
+
if Delayed::Worker.method_defined? :handle_failed_job
|
2
|
+
class Delayed::Worker
|
3
|
+
def handle_failed_job_with_exceptional(job, e)
|
4
|
+
Exceptional.handle(e, "Delayed::Job #{job.name}")
|
5
|
+
handle_failed_job_without_exceptional(job, e)
|
6
6
|
Exceptional.context.clear!
|
7
7
|
end
|
8
|
-
alias_method_chain :
|
8
|
+
alias_method_chain :handle_failed_job, :exceptional
|
9
9
|
Exceptional.logger.info "DJ integration enabled"
|
10
10
|
end
|
11
|
-
|
11
|
+
else
|
12
|
+
message = "\n\n\nThe Exceptional gem does not support Delayed Job 1.8.4 or earlier.\n\n\n"
|
13
|
+
STDERR.puts(message)
|
14
|
+
Exceptional.logger.error(message)
|
12
15
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Exceptional
|
2
|
+
module ExceptionMiddleware
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.send(:alias_method_chain,:render_exception,:exceptional)
|
6
|
+
end
|
7
|
+
|
8
|
+
def render_exception_with_exceptional(env,exception)
|
9
|
+
::Exceptional::Catcher.handle_with_controller(exception,
|
10
|
+
env['action_controller.instance'],
|
11
|
+
Rack::Request.new(env))
|
12
|
+
render_exception_without_exceptional(env,exception)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rack'
|
3
3
|
|
4
|
-
module Rack
|
5
|
-
class Exceptional
|
4
|
+
module Rack
|
5
|
+
class Exceptional
|
6
6
|
|
7
7
|
def initialize(app, api_key = nil)
|
8
8
|
@app = app
|
@@ -14,8 +14,8 @@ module Rack
|
|
14
14
|
::Exceptional::Config.enabled = true
|
15
15
|
::Exceptional.logger.info "Enabling Exceptional for Rack"
|
16
16
|
end
|
17
|
-
end
|
18
|
-
|
17
|
+
end
|
18
|
+
|
19
19
|
def call(env)
|
20
20
|
begin
|
21
21
|
status, headers, body = @app.call(env)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rack'
|
3
3
|
|
4
|
-
module Rack
|
5
|
-
class RailsExceptional
|
4
|
+
module Rack
|
5
|
+
class RailsExceptional
|
6
6
|
|
7
7
|
def initialize(app)
|
8
8
|
@app = app
|
9
|
-
end
|
10
|
-
|
9
|
+
end
|
10
|
+
|
11
11
|
def call(env)
|
12
12
|
begin
|
13
13
|
body = @app.call(env)
|
@@ -21,6 +21,6 @@ module Rack
|
|
21
21
|
end
|
22
22
|
|
23
23
|
body
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Exceptional::Rake
|
2
|
+
# Integrates Exceptional with Rake
|
3
|
+
#
|
4
|
+
# Usage:
|
5
|
+
#
|
6
|
+
# Simply load it inside of your Rakefile.
|
7
|
+
#
|
8
|
+
# require "exceptional"
|
9
|
+
# require "exceptional/integration/rake"
|
10
|
+
#
|
11
|
+
# task :exceptional do
|
12
|
+
# ...
|
13
|
+
# # exception happens here
|
14
|
+
# raise SomeUnexpectedException
|
15
|
+
# ...
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# Remember to load your Exceptional configuration if
|
20
|
+
# you're using Exceptional outside Rails
|
21
|
+
#
|
22
|
+
# Exceptional::Config.load("/path/to/config.yml")
|
23
|
+
#
|
24
|
+
def self.included(base)
|
25
|
+
base.send(:alias_method,
|
26
|
+
:standard_exception_handling,
|
27
|
+
:standard_exception_handling_with_exceptional)
|
28
|
+
end
|
29
|
+
|
30
|
+
def standard_exception_handling_with_exceptional
|
31
|
+
begin
|
32
|
+
yield
|
33
|
+
rescue SystemExit => ex
|
34
|
+
# Exit silently with current status
|
35
|
+
raise
|
36
|
+
rescue OptionParser::InvalidOption => ex
|
37
|
+
$stderr.puts ex.message
|
38
|
+
exit(false)
|
39
|
+
rescue Exception => ex
|
40
|
+
# Exit with error message
|
41
|
+
Exceptional::Catcher.handle(ex)
|
42
|
+
display_error_message(ex)
|
43
|
+
Exceptional.clear!
|
44
|
+
exit(false)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Rake::Application.send(:include,Exceptional::Rake)
|
50
|
+
|
51
|
+
Exceptional.logger.info "Rake integration enabled"
|
@@ -10,7 +10,7 @@ module Exceptional
|
|
10
10
|
unless Exceptional::Remote.error(Exceptional::ExceptionData.new(e, "Test Exception"))
|
11
11
|
puts "Problem sending exception to Exceptional. Check your API key."
|
12
12
|
else
|
13
|
-
puts "Test Exception sent. Please login to http://
|
13
|
+
puts "Test Exception sent. Please login to http://exceptional.io to see it!"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/exceptional/railtie.rb
CHANGED
@@ -12,7 +12,15 @@ module Exceptional
|
|
12
12
|
|
13
13
|
if Exceptional::Config.should_send_to_api?
|
14
14
|
Exceptional.logger.info("Loading Exceptional #{Exceptional::VERSION} for #{Rails::VERSION::STRING}")
|
15
|
-
|
15
|
+
if defined?(ActionDispatch::DebugExceptions)
|
16
|
+
# rails 3.2.x
|
17
|
+
ActionDispatch::DebugExceptions.send(:include,Exceptional::ExceptionMiddleware)
|
18
|
+
elsif defined?(ActionDispatch::ShowExceptions)
|
19
|
+
# rails 3.0.x && 3.1.x
|
20
|
+
ActionDispatch::ShowExceptions.send(:include,Exceptional::ExceptionMiddleware)
|
21
|
+
else
|
22
|
+
app.config.middleware.use "Rack::RailsExceptional"
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|
18
26
|
end
|
data/lib/exceptional/version.rb
CHANGED
data/spec/dj_integration_spec.rb
CHANGED
@@ -1,29 +1,51 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
|
4
|
+
describe "Delayed Job integration for DJ < 1.8.5" do
|
5
|
+
before do
|
6
|
+
module Delayed
|
7
|
+
class Worker
|
8
|
+
end
|
9
|
+
end
|
10
10
|
end
|
11
|
+
it "should report the lack of support to STDERR" do
|
12
|
+
STDERR.should_receive(:puts).with("\n\n\nThe Exceptional gem does not support Delayed Job 1.8.4 or earlier.\n\n\n")
|
13
|
+
load File.join(File.dirname(__FILE__), '..', 'lib', 'exceptional', 'integration', 'dj.rb')
|
14
|
+
end
|
15
|
+
it "should report the lack of support to Exceptional.logger" do
|
16
|
+
STDERR.stub(:puts)
|
17
|
+
Exceptional.logger.should_receive(:error).with("\n\n\nThe Exceptional gem does not support Delayed Job 1.8.4 or earlier.\n\n\n")
|
18
|
+
load File.join(File.dirname(__FILE__), '..', 'lib', 'exceptional', 'integration', 'dj.rb')
|
11
19
|
end
|
12
20
|
end
|
13
21
|
|
14
|
-
|
15
|
-
|
16
|
-
describe Delayed::Job do
|
22
|
+
describe 'Delayed Job integration' do
|
17
23
|
before :each do
|
18
|
-
|
24
|
+
Exceptional::Config.stub!(:should_send_to_api?).and_return(true)
|
25
|
+
Exceptional.stub(:handle)
|
26
|
+
|
27
|
+
module Delayed
|
28
|
+
class Worker
|
29
|
+
def handle_failed_job(job, exception); end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
load File.join(File.dirname(__FILE__), '..', 'lib', 'exceptional', 'integration', 'dj.rb')
|
33
|
+
@worker = Delayed::Worker.new
|
19
34
|
@exception = StandardError.new
|
35
|
+
@job = mock(:name => "My delayed job")
|
20
36
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
describe "For Delayed Job > 1.8.5" do
|
38
|
+
it "should handle exceptions with Exceptional" do
|
39
|
+
Exceptional.should_receive(:handle).with(@exception, 'Delayed::Job My delayed job')
|
40
|
+
@worker.handle_failed_job(@job, @exception)
|
41
|
+
end
|
42
|
+
it "should clear context" do
|
43
|
+
Exceptional.should_receive(:clear!)
|
44
|
+
@worker.handle_failed_job(@job, @exception)
|
45
|
+
end
|
46
|
+
it "should invoke the original handle_failed_job" do
|
47
|
+
@worker.should_receive(:handle_failed_job_without_exceptional).with(@job, @exception)
|
48
|
+
@worker.handle_failed_job(@job, @exception)
|
49
|
+
end
|
28
50
|
end
|
29
51
|
end
|
@@ -6,6 +6,6 @@ describe Exceptional::AlertData do
|
|
6
6
|
result_json = JSON.parse(data.to_json)
|
7
7
|
result_json['rescue_block']['name'].should == 'Alert'
|
8
8
|
result_json['exception']['message'].should == "A string"
|
9
|
-
result_json['exception']['exception_class'] == 'Exceptional::Alert'
|
9
|
+
result_json['exception']['exception_class'].should == 'Exceptional::Alert'
|
10
10
|
end
|
11
11
|
end
|
@@ -1,13 +1,37 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
describe Exceptional::Catcher do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
describe "when Exceptional reporting is on" do
|
5
|
+
before do
|
6
|
+
Exceptional::Config.stub(:should_send_to_api?).and_return(true)
|
7
|
+
end
|
8
|
+
it "handle_with_controller should create exception_data object and send json to the api" do
|
9
|
+
exception = mock('exception')
|
10
|
+
controller = mock('controller')
|
11
|
+
request = mock('request')
|
12
|
+
Exceptional::ControllerExceptionData.should_receive(:new).with(exception,controller,request).and_return(data = mock('exception_data'))
|
13
|
+
Exceptional::Remote.should_receive(:error).with(data)
|
14
|
+
Exceptional::Catcher.handle_with_controller(exception,controller,request)
|
15
|
+
end
|
16
|
+
# it "handle_with_rack should create exception_data object and send json to the api"
|
17
|
+
# it "handle should create exception_data object and send json to the api"
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "when Exceptional reporting is off" do
|
21
|
+
before do
|
22
|
+
Exceptional::Config.stub(:should_send_to_api?).and_return(false)
|
23
|
+
end
|
24
|
+
it "handle_with_controller should reraise the exception and not report it" do
|
25
|
+
exception = mock('exception')
|
26
|
+
controller = mock('controller')
|
27
|
+
request = mock('request')
|
28
|
+
Exceptional::ControllerExceptionData.should_not_receive(:new)
|
29
|
+
Exceptional::Remote.should_not_receive(:error)
|
30
|
+
expect{
|
31
|
+
Exceptional::Catcher.handle_with_controller(exception,controller,request)
|
32
|
+
}.to raise_error
|
33
|
+
end
|
34
|
+
# it "handle_with_rack should reraise the exception and not report it"
|
35
|
+
# it "handle should reraise the exception and not report it"
|
12
36
|
end
|
13
37
|
end
|
@@ -127,6 +127,13 @@ describe Exceptional::ControllerExceptionData, 'with request/controller/params'
|
|
127
127
|
data.to_hash['request']['parameters'].should == {'var1' => '[FILTERED]'}
|
128
128
|
end
|
129
129
|
|
130
|
+
it "filter nested params specified in env['action_dispatch.parameter_filter']" do
|
131
|
+
@request.stub!(:env).and_return({'SOME_VAR' => 'abc', 'HTTP_CONTENT_TYPE' => 'text/html', 'action_dispatch.parameter_filter' => [:var1]})
|
132
|
+
@request.stub!(:parameters).and_return({'var1' => {'var2' => 'abc','var3' => "abc"}})
|
133
|
+
data = Exceptional::ControllerExceptionData.new(@error, @controller, @request)
|
134
|
+
data.to_hash['request']['parameters'].should == {'var1' => '[FILTERED]'}
|
135
|
+
end
|
136
|
+
|
130
137
|
it "formats the occurred_at as iso8601" do
|
131
138
|
@request.stub!(:env).and_return({'SOME_VAR' => 'abc', 'HTTP_CONTENT_TYPE' => 'text/html', 'action_dispatch.parameter_filter' => [:var1]})
|
132
139
|
@request.stub!(:parameters).and_return({'var1' => 'abc'})
|
@@ -195,4 +202,4 @@ describe Exceptional::ControllerExceptionData, 'with request/controller/params'
|
|
195
202
|
data = Exceptional::ControllerExceptionData.new(exception)
|
196
203
|
data.uniqueness_hash.should == nil
|
197
204
|
end
|
198
|
-
end
|
205
|
+
end
|
@@ -37,7 +37,7 @@ describe TestingController do
|
|
37
37
|
@response.code.should == '500'
|
38
38
|
end
|
39
39
|
|
40
|
-
it "filters
|
40
|
+
it "filters parameters based on controller filter_parameter_logging" do
|
41
41
|
Exceptional::Config.stub!(:should_send_to_api?).and_return(true)
|
42
42
|
Exceptional::Remote.should_receive(:error) {|exception_data|
|
43
43
|
exception_data.to_hash['request']['parameters']['credit_card_number'].should == '[FILTERED]'
|
@@ -92,4 +92,4 @@ if ActionController::Base.respond_to?(:rescue_from)
|
|
92
92
|
Thread.current[:exceptional_context].should == nil
|
93
93
|
end
|
94
94
|
end
|
95
|
-
end
|
95
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe 'Rake integration' do
|
4
|
+
before :each do
|
5
|
+
Exceptional::Config.stub!(:should_send_to_api?).and_return(true)
|
6
|
+
Exceptional.stub(:handle)
|
7
|
+
|
8
|
+
module Rake
|
9
|
+
class Application
|
10
|
+
def standard_exception_handling; end
|
11
|
+
def display_error_message(exception); end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
load File.join(File.dirname(__FILE__), '..', 'lib', 'exceptional', 'integration', 'rake.rb')
|
15
|
+
@application = Rake::Application.new
|
16
|
+
@exception = StandardError.new "Some rake error"
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "Rake == 0.9.9.2" do
|
20
|
+
it "should handle exceptions with Exceptional" do
|
21
|
+
Exceptional::Catcher.should_receive(:handle).with(@exception)
|
22
|
+
lambda do
|
23
|
+
@application.standard_exception_handling do
|
24
|
+
raise @exception
|
25
|
+
end
|
26
|
+
end.should raise_error SystemExit
|
27
|
+
end
|
28
|
+
it "should clear context" do
|
29
|
+
Exceptional.should_receive(:clear!)
|
30
|
+
lambda do
|
31
|
+
@application.standard_exception_handling do
|
32
|
+
raise @exception
|
33
|
+
end
|
34
|
+
end.should raise_error SystemExit
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,8 @@ end
|
|
8
8
|
gem 'rails'
|
9
9
|
require File.dirname(__FILE__) + '/../lib/exceptional' unless defined?(Exceptional)
|
10
10
|
|
11
|
+
alias :context :describe
|
12
|
+
|
11
13
|
ENV['RAILS_ENV'] = 'test'
|
12
14
|
|
13
15
|
require 'action_controller'
|
@@ -20,4 +22,4 @@ def send_request(action = nil,params={})
|
|
20
22
|
@request.action = action ? action.to_s : ""
|
21
23
|
@response = ActionController::TestResponse.new
|
22
24
|
@controller.process(@request, @response)
|
23
|
-
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exceptional
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 77
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 33
|
10
|
+
version: 2.0.33
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Contrast
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-10-05 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rack
|
@@ -32,7 +31,7 @@ dependencies:
|
|
32
31
|
version: "0"
|
33
32
|
type: :runtime
|
34
33
|
version_requirements: *id001
|
35
|
-
description: Exceptional is the Ruby gem for communicating with http://
|
34
|
+
description: Exceptional is the Ruby gem for communicating with http://exceptional.io (hosted error tracking service). Use it to find out about errors that happen in your live app. It captures lots of helpful information to help you fix the errors.
|
36
35
|
email: hello@contrast.ie
|
37
36
|
executables:
|
38
37
|
- exceptional
|
@@ -41,57 +40,59 @@ extensions: []
|
|
41
40
|
extra_rdoc_files: []
|
42
41
|
|
43
42
|
files:
|
44
|
-
- lib/exceptional
|
43
|
+
- lib/exceptional.rb
|
44
|
+
- lib/tasks/exceptional_tasks.rake
|
45
|
+
- lib/exceptional/startup.rb
|
45
46
|
- lib/exceptional/application_environment.rb
|
46
|
-
- lib/exceptional/catcher.rb
|
47
|
-
- lib/exceptional/config.rb
|
48
|
-
- lib/exceptional/controller_exception_data.rb
|
49
|
-
- lib/exceptional/exception_data.rb
|
50
47
|
- lib/exceptional/integration/alerter.rb
|
51
|
-
- lib/exceptional/integration/dj.rb
|
52
|
-
- lib/exceptional/integration/rack.rb
|
53
|
-
- lib/exceptional/integration/rack_rails.rb
|
54
48
|
- lib/exceptional/integration/rails.rb
|
55
|
-
- lib/exceptional/integration/
|
49
|
+
- lib/exceptional/integration/rake.rb
|
56
50
|
- lib/exceptional/integration/tester.rb
|
51
|
+
- lib/exceptional/integration/rack.rb
|
52
|
+
- lib/exceptional/integration/exception_middleware.rb
|
53
|
+
- lib/exceptional/integration/sinatra.rb
|
54
|
+
- lib/exceptional/integration/dj.rb
|
55
|
+
- lib/exceptional/integration/rack_rails.rb
|
56
|
+
- lib/exceptional/controller_exception_data.rb
|
57
|
+
- lib/exceptional/exception_data.rb
|
57
58
|
- lib/exceptional/log_factory.rb
|
58
|
-
- lib/exceptional/
|
59
|
-
- lib/exceptional/rack_exception_data.rb
|
59
|
+
- lib/exceptional/config.rb
|
60
60
|
- lib/exceptional/railtie.rb
|
61
|
-
- lib/exceptional/
|
62
|
-
- lib/exceptional/
|
61
|
+
- lib/exceptional/alert_data.rb
|
62
|
+
- lib/exceptional/rack_exception_data.rb
|
63
|
+
- lib/exceptional/catcher.rb
|
63
64
|
- lib/exceptional/version.rb
|
64
|
-
- lib/exceptional.rb
|
65
|
-
- lib/
|
65
|
+
- lib/exceptional/monkeypatches.rb
|
66
|
+
- lib/exceptional/remote.rb
|
67
|
+
- spec/ginger_scenarios.rb
|
66
68
|
- spec/bin/ginger
|
67
|
-
- spec/
|
69
|
+
- spec/rails_integration_spec.rb
|
70
|
+
- spec/rack_integration_spec.rb
|
71
|
+
- spec/exceptional_rescue_spec.rb
|
72
|
+
- spec/rails_rack_integration_spec.rb
|
73
|
+
- spec/fixtures/favicon.png
|
74
|
+
- spec/fixtures/exceptional_old.yml
|
75
|
+
- spec/fixtures/exceptional_disabled.yml
|
76
|
+
- spec/fixtures/exceptional.yml
|
77
|
+
- spec/rake_integration_spec.rb
|
78
|
+
- spec/exceptional/monkeypatches_spec.rb
|
68
79
|
- spec/exceptional/alert_exception_data_spec.rb
|
69
80
|
- spec/exceptional/catcher_spec.rb
|
70
|
-
- spec/exceptional/config_spec.rb
|
71
81
|
- spec/exceptional/controller_exception_data_spec.rb
|
72
|
-
- spec/exceptional/exception_data_spec.rb
|
73
|
-
- spec/exceptional/monkeypatches_spec.rb
|
74
|
-
- spec/exceptional/rack_exception_data_spec.rb
|
75
82
|
- spec/exceptional/remote_spec.rb
|
76
83
|
- spec/exceptional/startup_spec.rb
|
77
|
-
- spec/
|
78
|
-
- spec/
|
79
|
-
- spec/
|
80
|
-
- spec/fixtures/exceptional_old.yml
|
81
|
-
- spec/fixtures/favicon.png
|
82
|
-
- spec/ginger_scenarios.rb
|
83
|
-
- spec/rack_integration_spec.rb
|
84
|
-
- spec/rails_integration_spec.rb
|
85
|
-
- spec/rails_rack_integration_spec.rb
|
84
|
+
- spec/exceptional/config_spec.rb
|
85
|
+
- spec/exceptional/rack_exception_data_spec.rb
|
86
|
+
- spec/exceptional/exception_data_spec.rb
|
86
87
|
- spec/spec_helper.rb
|
88
|
+
- spec/dj_integration_spec.rb
|
87
89
|
- spec/standalone_spec.rb
|
88
90
|
- rails/init.rb
|
89
91
|
- init.rb
|
90
92
|
- install.rb
|
91
93
|
- exceptional.gemspec
|
92
94
|
- bin/exceptional
|
93
|
-
|
94
|
-
homepage: http://getexceptional.com/
|
95
|
+
homepage: http://exceptional.io/
|
95
96
|
licenses: []
|
96
97
|
|
97
98
|
post_install_message:
|
@@ -120,9 +121,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
requirements:
|
121
122
|
- json_pure, json-jruby or json gem required
|
122
123
|
rubyforge_project: exceptional
|
123
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.8.24
|
124
125
|
signing_key:
|
125
126
|
specification_version: 3
|
126
|
-
summary:
|
127
|
+
summary: exceptional.io is a hosted service for tracking errors in your Ruby/Rails/Rack apps
|
127
128
|
test_files: []
|
128
129
|
|