Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

play nicer; perhaps jobs may want to raise in on_failure hook to avoi…

…d reporting
  • Loading branch information...
commit cea58cce6ada94c75369ab9be2715cb389199c08 1 parent e8ef7fe
Ryan Biesemeyer authored steveklabnik committed

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. 9  lib/resque/job.rb
9  lib/resque/job.rb
@@ -166,6 +166,13 @@ def payload_class
166 166
       @payload_class ||= constantize(@payload['class'])
167 167
     end
168 168
 
  169
+    # returns true if payload_class does not raise NameError
  170
+    def has_payload_class?
  171
+      payload_class != Object
  172
+    rescue NameError
  173
+      false
  174
+    end
  175
+
169 176
     # Returns an array of args represented in this job's payload.
170 177
     def args
171 178
       @payload['args']
@@ -174,7 +181,7 @@ def args
174 181
     # Given an exception object, hands off the needed parameters to
175 182
     # the Failure module.
176 183
     def fail(exception)
177  
-      run_failure_hooks(exception) rescue nil
  184
+      run_failure_hooks(exception) if has_payload_class?
178 185
       Failure.create \
179 186
         :payload   => payload,
180 187
         :exception => exception,

0 notes on commit cea58cc

Please sign in to comment.
Something went wrong with that request. Please try again.