From 9b9bfae1d8c87481e3b60266f7310d06c05b5398 Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Thu, 26 Mar 2026 11:45:41 -0400 Subject: [PATCH] backport: handle non-exceptions in `panic` i suspect, but have no evidence, that this is motivated by EM::HttpClient --- sgx-bwmsgsv2.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index e9a29d999321d70dca6d0cfa47cad7c4a4b05e55..5a86b2292a547a7a33d5992beaaaacfde19844da 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -139,9 +139,15 @@ MMS_MIME_TYPES = [ ] def panic(e) - Sentry.capture_exception(e) - puts "Shutting down gateway due to exception: #{e.message}" - puts e.backtrace + if e.is_a?(Exception) + puts "[#{Time.now.iso8601}] Shutting down gateway due to exception: #{e.message}" + Sentry.capture_exception(e, hint: { background: false }) + puts e.backtrace + else + puts "[#{Time.now.iso8601}] Shutting down gateway due to non-exception:" + p e + Sentry.capture_message(e.to_s, hint: { background: false }) + end SGXbwmsgsv2.shutdown puts 'Gateway has terminated.' EM.stop