lib/loggery/metadata/middleware/sidekiq.rb in loggery-0.2.1 vs lib/loggery/metadata/middleware/sidekiq.rb in loggery-0.3.0
- old
+ new
@@ -17,17 +17,15 @@
Loggery::Metadata::Store.with_metadata(build_metadata(message, queue)) do
job_instance_name = "#{message['class']} (#{message['args']})"
log_job_start(message, job_instance_name)
log_job_runtime(:sidekiq_job, job_instance_name) do
- begin
- yield
- rescue StandardError => e
- # Log exceptions here, otherwise they won't have the metadata available anymore by
- # the time they reach the Sidekiq default error handler.
- self.class.error_handler&.call(e)
- raise e
- end
+ yield
+ rescue StandardError => e
+ # Log exceptions here, otherwise they won't have the metadata available anymore by
+ # the time they reach the Sidekiq default error handler.
+ self.class.error_handler&.call(e)
+ raise e
end
end
end
private