<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,15 +2,6 @@ require 'json' unless defined? Rails
 
 module Exceptional
   module Api
-    # parse an exception into an ExceptionData object
-    def parse(exception)
-      exception_data = ExceptionData.new
-      exception_data.exception_backtrace = exception.backtrace
-      exception_data.exception_message = exception.message
-      exception_data.exception_class = exception.class.to_s
-      exception_data
-    end
-
     # post the given exception data to getexceptional.com
     def post(exception_data)
       hash = exception_data.to_hash
@@ -27,20 +18,20 @@ module Exceptional
     def handle(exception, controller, request, params)
       Exceptional.log! &quot;Handling #{exception.message}&quot;, 'info'
       begin
-        e = parse(exception)
+        exception_data = ExceptionData.new(exception)
         # Additional data for Rails Exceptions
-        e.framework = &quot;rails&quot;
-        e.controller_name = controller.controller_name
-        e.action_name = controller.action_name
-        e.application_root = Exceptional.application_root
-        e.occurred_at = Time.now.strftime(&quot;%Y%m%d %H:%M:%S %Z&quot;)
-        e.environment = request.env.to_hash
-        e.url = &quot;#{request.protocol}#{request.host}#{request.request_uri}&quot;
-        e.environment = safe_environment(request)
-        e.session = safe_session(request.session)
-        e.parameters = sanitize_hash(params.to_hash)
+        exception_data.framework = &quot;rails&quot;
+        exception_data.controller_name = controller.controller_name
+        exception_data.action_name = controller.action_name
+        exception_data.application_root = Exceptional.application_root
+        exception_data.occurred_at = Time.now.strftime(&quot;%Y%m%d %H:%M:%S %Z&quot;)
+        exception_data.environment = request.env.to_hash
+        exception_data.url = &quot;#{request.protocol}#{request.host}#{request.request_uri}&quot;
+        exception_data.environment = safe_environment(request)
+        exception_data.session = safe_session(request.session)
+        exception_data.parameters = sanitize_hash(params.to_hash)
 
-        post(e)
+        post(exception_data)
       rescue Exception =&gt; exception
         Exceptional.log! &quot;Error preparing exception data.&quot;
         Exceptional.log! exception.message
@@ -61,7 +52,7 @@ module Exceptional
     end
 
     def catch(exception)
-      exception_data = parse(exception)
+      exception_data = ExceptionData.new(exception)
       exception_data.controller_name = File.basename($0)
       post(exception_data)
     end</diff>
      <filename>lib/exceptional/api.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,10 +15,13 @@ module Exceptional
     end
     attr_reader   :language
 
-    def initialize
+    def initialize(exception)
       environment = {}
       session = {}
       parameters = {}
+      self.exception_backtrace = exception.backtrace
+      self.exception_message = exception.message
+      self.exception_class = exception.class.to_s
       @language = ::LANGUAGE
     end
     </diff>
      <filename>lib/exceptional/exception_data.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,14 +10,16 @@ if defined? ActionController
     class Base
     
       def rescue_action_with_exceptional(exception)
-        # TODO potentially hook onto rescue_without_handler if it exists? would negate need to check handler_for_rescue every time.
-        # if there's handler defined with rescue_from() do not call Exceptional
-        if !(respond_to?(:handler_for_rescue) &amp;&amp; handler_for_rescue(exception))
+        unless exception_will_be_handled_by_rescue_from?(exception)
           params_to_send = (respond_to? :filter_parameters) ? filter_parameters(params) : params
           Exceptional.handle(exception, self, request, params_to_send)
         end
-            
-        rescue_action_without_exceptional exception
+        rescue_action_without_exceptional(exception)
+      end
+
+      def exception_will_be_handled_by_rescue_from?(exception)
+        # don't report to exceptional if app has custom rescue_from for particular exception
+        respond_to?(:handler_for_rescue) &amp;&amp; handler_for_rescue(exception)
       end
     
       alias_method :rescue_action_without_exceptional, :rescue_action</diff>
      <filename>lib/exceptional/integration/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ describe Exceptional::Api do
     it &quot;should parse exception into exception data object&quot; do
       exception = mock(Exception, :message =&gt; &quot;Something bad has happened&quot;,
                        :backtrace =&gt; [&quot;/app/controllers/buggy_controller.rb:29:in `index'&quot;])
-      exception_data = Exceptional.parse(exception)
+      exception_data = Exceptional::ExceptionData.new(exception)
       exception_data.kind_of?(Exceptional::ExceptionData).should be_true
       exception_data.exception_message.should == exception.message
       exception_data.exception_backtrace.should == exception.backtrace
@@ -49,7 +49,7 @@ describe Exceptional::Api do
                             :class =&gt; Exception, :to_hash =&gt; { :message =&gt; &quot;Something bad has happened&quot; })
       exception_data.should_receive(:controller_name=).with(File.basename($0))
 
-      Exceptional.should_receive(:parse, :with =&gt; [exception]).and_return(exception_data)
+      Exceptional::ExceptionData.should_receive(:new).with(exception).and_return(exception_data)
       Exceptional.should_receive(:post, :with =&gt; [exception_data])
 
       Exceptional.catch(exception)</diff>
      <filename>spec/api_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,10 +3,8 @@ require File.dirname(__FILE__) + '/spec_helper'
 describe Exceptional::ExceptionData do
   describe &quot;with valid base data&quot; do
     before(:each) do
-      @exception_data = Exceptional::ExceptionData.new
-      @exception_data.exception_class = &quot;Error&quot;
-      @exception_data.exception_message = &quot;There was an error&quot;
-      @exception_data.exception_backtrace = &quot;/var/www/app/fail.rb:42 Error('There was an error')&quot;
+      exception = mock('Exception', :backtrace =&gt; &quot;/var/www/app/fail.rb:42 Error('There was an error')&quot;, :message =&gt; &quot;There was an error&quot;, :class =&gt; 'Error')
+      @exception_data = Exceptional::ExceptionData.new(exception)
     end
     
     it &quot;language should be ruby&quot; do</diff>
      <filename>spec/exception_data_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3354e8e41d9925cd946345ecd710acbde7db480d</id>
    </parent>
  </parents>
  <author>
    <name>Darragh Curran</name>
    <email>darragh@peelmeagrape.net</email>
  </author>
  <url>http://github.com/contrast/exceptional/commit/9787a7207b8a268344726c29f28dfa042b49e1a9</url>
  <id>9787a7207b8a268344726c29f28dfa042b49e1a9</id>
  <committed-date>2009-09-24T09:22:33-07:00</committed-date>
  <authored-date>2009-09-24T09:22:33-07:00</authored-date>
  <message>simplify ExceptionData class, constructor takes exception</message>
  <tree>719dc6476936a00e2d2ec5bc0ebf1e49eb34f3f5</tree>
  <committer>
    <name>Darragh Curran</name>
    <email>darragh@peelmeagrape.net</email>
  </committer>
</commit>
