Class: Toro::Middleware::Server::ErrorStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/toro/middleware/server/error_storage.rb

Instance Method Summary collapse

Instance Method Details

#call(job, worker) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/toro/middleware/server/error_storage.rb', line 5

def call(job, worker)
  begin
    yield
  rescue Exception => exception
    job.reload
    job.set_properties(
      'error:class' => exception.class.name,
      'error:message' => exception.message,
      'error:backtrace' => exception.backtrace
    )
    job.save
    raise exception
  end
end