Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix deserialization error crash

DJ was crashing when unexpected exception has been raised from
YAML.load. Changed it to rescue all Exceptions and transform them to
DeserializationErrors.
  • Loading branch information...
commit 78142d390533b4e47b78b21fba34b368f7fad4be 1 parent 0333bf1
@nazgob nazgob authored
View
2  lib/delayed/backend/base.rb
@@ -83,7 +83,7 @@ def payload_object=(object)
def payload_object
@payload_object ||= YAML.load(self.handler)
- rescue TypeError, LoadError, NameError, ArgumentError => e
+ rescue Exception => e
raise DeserializationError,
"Job failed to load: #{e.message}. Handler: #{handler.inspect}"
end
View
6 lib/delayed/backend/shared_spec.rb
@@ -174,6 +174,12 @@ def create_job(opts = {})
YAML.should_receive(:load).and_raise(ArgumentError)
lambda { job.payload_object }.should raise_error(Delayed::DeserializationError)
end
+
+ it "should raise a DeserializationError when the YAML.load raises an unexpected error" do
+ job = described_class.new :handler => "--- !ruby/struct:GoingToRaiseArgError {}"
+ YAML.should_receive(:load).and_raise(Exception)
+ lambda { job.payload_object }.should raise_error(Delayed::DeserializationError)
+ end
end
describe "reserve" do
Please sign in to comment.
Something went wrong with that request. Please try again.