Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

command line alerts

  • Loading branch information...
commit 3cfdef10476d7383a6554e637b8981a33945a2b8 1 parent 5e9e9fa
Wal authored
View
5 bin/exceptional
@@ -36,12 +36,11 @@ USAGE
require "exceptional"
require "exceptional/alert_data"
require "exceptional/integration/alerter"
- Exceptional::Config.load('/etc/exceptional.yml')
- Exceptional::Config.load('./exceptional.yml') # overwrites prior load, if exists
+ Exceptional::Config.load('config/exceptional.yml')
if Exceptional::Config.api_key
exit(Exceptional::Integration.alert(args[0]) ? 0 : 2)
else
- puts 'API key not configured. Put exceptional.yml in current directory or /etc'
+ puts 'API key not configured. Put exceptional.yml in current directory or /config'
exit(1)
end
when 'install'
View
2  lib/exceptional.rb
@@ -9,9 +9,11 @@
require 'exceptional/exception_data'
require 'exceptional/controller_exception_data'
require 'exceptional/rack_exception_data'
+require 'exceptional/alert_data'
require 'exceptional/remote'
require 'exceptional/integration/rack'
require 'exceptional/integration/rack_rails'
+require 'exceptional/integration/alerter'
require 'exceptional/version'
require 'exceptional/railtie' if defined?(Rails::Railtie)
View
2  lib/exceptional/integration/alerter.rb
@@ -4,7 +4,7 @@ class Alert <StandardError;
module Integration
def self.alert(msg, env={})
- return Exceptional::Remote.error(Exceptional::AlertData.new(Alert.new(msg)))
+ return Exceptional::Remote.error(Exceptional::AlertData.new(Alert.new(msg), "Alert"))
end
end
end
View
12 spec/exceptional/alert_exception_data_spec.rb
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe Exceptional::AlertData do
+ it "raises error" do
+ data = Exceptional::AlertData.new(Exceptional::Alert.new("A string"), "Alert")
+ result_json = JSON.parse(data.to_json)
+ puts result_json.inspect
+ result_json['rescue_block']['name'].should == 'Alert'
+ result_json['exception']['message'].should == "A string"
+ result_json['exception']['exception_class'] == 'Exceptional::Alert'
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.