File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 7
7
data = {
8
8
:failed_at => Time . now . strftime ( "%Y/%m/%d %H:%M:%S" ) ,
9
9
:payload => payload ,
10
+ :exception => exception . class . to_s ,
10
11
:error => exception . to_s ,
11
12
:backtrace => exception . backtrace ,
12
13
:worker => worker . to_s ,
Original file line number Diff line number Diff line change 20
20
< dd > < code > <%= job [ 'payload' ] [ 'class' ] %> </ code > </ dd >
21
21
< dt > Arguments</ dt >
22
22
< dd > < pre > <%= h show_args ( job [ 'payload' ] [ 'args' ] ) %> </ pre > </ dd >
23
+ < dt > Exception</ td >
24
+ < dd > < code > <%= job [ 'exception' ] %> </ code > </ dd >
23
25
< dt > Error</ dt >
24
26
< dd class ='error '>
25
27
< a href ="# " class ="backtrace "> <%= h ( job [ 'error' ] ) %> </ a >
Original file line number Diff line number Diff line change @@ -94,3 +94,9 @@ def self.perform(name)
94
94
"Good job, #{ name } "
95
95
end
96
96
end
97
+
98
+ class BadJobWithSyntaxError
99
+ def self . perform
100
+ raise SyntaxError , "Extra Bad job!"
101
+ end
102
+ end
Original file line number Diff line number Diff line change 17
17
@worker . work ( 0 )
18
18
assert_equal 1 , Resque ::Failure . count
19
19
end
20
+
21
+ test "failed jobs report excpetion and message" do
22
+ Resque ::Job . create ( :jobs , BadJobWithSyntaxError )
23
+ @worker . work ( 0 )
24
+ assert_equal ( 'SyntaxError' , Resque ::Failure . all [ 'exception' ] )
25
+ assert_equal ( 'Extra Bad job!' , Resque ::Failure . all [ 'error' ] )
26
+ end
20
27
21
28
test "can peek at failed jobs" do
22
29
10 . times { Resque ::Job . create ( :jobs , BadJob ) }
You can’t perform that action at this time.
0 commit comments