From 2d63b5227d1923cbc4b59cfe14bff2ced050a189 Mon Sep 17 00:00:00 2001 From: JamesJJ Date: Thu, 10 May 2018 23:53:32 +0800 Subject: [PATCH] Safer error handling --- lib/fluent/plugin/in_sqs.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/in_sqs.rb b/lib/fluent/plugin/in_sqs.rb index a79cb04..b0efabe 100644 --- a/lib/fluent/plugin/in_sqs.rb +++ b/lib/fluent/plugin/in_sqs.rb @@ -59,9 +59,9 @@ def run router.emit(@tag, Fluent::Engine.now, record) end - rescue - log.error 'failed to emit or receive', error: $ERROR_INFO.to_s, error_class: $ERROR_INFO.class.to_s - log.warn_backtrace $ERROR_INFO.backtrace + rescue => ex + log.error 'failed to emit or receive', error: ex.to_s, error_class: ex.class + log.warn_backtrace ex.backtrace end private