Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/460'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/delayed/backend/base.rb
  • Loading branch information
albus522 committed Sep 24, 2014
2 parents acdda42 + d1f53b4 commit 6c64064
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/delayed/backend/base.rb
Expand Up @@ -83,7 +83,7 @@ def payload_object=(object)

def payload_object
@payload_object ||= YAML.load_dj(handler)
rescue TypeError, LoadError, NameError, ArgumentError => e
rescue TypeError, LoadError, NameError, ArgumentError, SyntaxError, Psych::SyntaxError => e
raise DeserializationError, "Job failed to load: #{e.message}. Handler: #{handler.inspect}"
end

Expand Down
8 changes: 8 additions & 0 deletions lib/delayed/backend/shared_spec.rb
Expand Up @@ -189,6 +189,14 @@ def create_job(opts = {})
expect(YAML).to receive(:load_dj).and_raise(ArgumentError)
expect { job.payload_object }.to raise_error(Delayed::DeserializationError)
end

it 'raises a DeserializationError when the YAML.load raises syntax error' do
# only test with Psych since the other YAML parsers don't raise a SyntaxError
if YAML.parser.class.name !~ /syck|yecht/i
job = described_class.new :handler => 'message: "no ending quote'
expect { job.payload_object }.to raise_error(Delayed::DeserializationError)
end
end
end

describe 'reserve' do
Expand Down

0 comments on commit 6c64064

Please sign in to comment.