Skip to content

Commit 77c79e1

Browse files
committed
more readme
1 parent 0737c90 commit 77c79e1

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

README

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
1-
= Exceptional plugin for Ruby on Rails
1+
# Exceptional plugin for Ruby on Rails
22

33
This plugin posts exception data to Exceptional (http://getexceptional.com). Data about the request, session, environment and a backtrace of the exception is transmitted.
44

5-
= Installation
5+
Once installed and configured, all exceptions from web requests are reported to Exceptional.
6+
7+
## Installation
68

79
1. gem install exceptional
810
2. Add config.gem 'exceptional' to 'config/environment.rb'
911
3. run 'exceptional install <api-key>' using the api-key for your app from http://getexceptional.com
1012

11-
Other ways to install:
13+
### Other ways to install:
1214

1315
1. traditional rails plugin install
1416
2. gem bundler
1517

16-
= Upgrading from old version of the exceptional plugin
18+
## Upgrading from old version of the exceptional plugin
1719

1820
1. Delete vendor/plugins/exceptional
1921
2. Follow installation instructions above
2022
3. (optional) Simplify your config/exceptional.yml file - all it needs now is a single line with 'api-key: YOUR-KEY'
2123

24+
25+
## Usage outside web requests (Daemons etc)
26+
27+
Exceptional.resuce do
28+
something_that_you_want_to_catch_exceptions_from
29+
end
30+
31+
This reports exceptions to Exceptional and re-raises them.
32+
33+
### (Optional) Loading exceptional config
34+
35+
You can either do something like
36+
37+
Exceptional::Config.load("config/exceptional.yml")
38+
39+
or
40+
41+
Exceptional.configure('YOUR_API-KEY')
42+
43+
2244
Please send any questions or comments to [email protected].
2345

2446
Copyright © 2008, 2009 Contrast.

lib/exceptional.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def self.logger
1818
::Exceptional::LogFactory.logger
1919
end
2020

21+
def self.configure(api_key)
22+
Exceptional::Config.api_key = api_key
23+
end
24+
2125
def self.rescue(&block)
2226
begin
2327
block.call

lib/exceptional/remote.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def call_remote(url, data)
3030
client = optional_proxy.new(config.remote_host, config.remote_port)
3131
client.open_timeout = config.http_open_timeout
3232
client.read_timeout = config.http_read_timeout
33-
client.use_ssl = true if config.ssl_enabled?
33+
client.use_ssl = config.ssl_enabled?
3434
begin
3535
response = client.post(url, data)
3636
case response

spec/exceptional/exception_data_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Exceptional::SomeController < ActionController::Base
6363
data = Exceptional::ExceptionData.new(error, @controller, @request)
6464
@hash = data.to_hash
6565
end
66+
6667
it "captures request" do
6768
request_hash = @hash['request']
6869
request_hash['url'].should == 'http://test.host/some_path?var1=abc'

spec/standalone_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require File.dirname(__FILE__) + '/spec_helper'
2+
require File.join(File.dirname(__FILE__), '..', 'lib', 'exceptional', 'integration', 'rails')
3+
4+
describe Exceptional do
5+
it "set the api key" do
6+
Exceptional.configure('api-key')
7+
Exceptional::Config.api_key.should == 'api-key'
8+
end
9+
end

0 commit comments

Comments
 (0)