From 9c9afb79b592111ba42e6da7d6df31d2ff917ab8 Mon Sep 17 00:00:00 2001 From: 24c02 <163450896+24c02@users.noreply.github.com> Date: Tue, 30 Dec 2025 12:22:11 -0500 Subject: [PATCH] event_id >_< --- app/controllers/base_batches_controller.rb | 2 +- app/controllers/letter/batches_controller.rb | 2 +- app/controllers/sessions_controller.rb | 2 +- app/controllers/warehouse/batches_controller.rb | 2 +- app/controllers/warehouse/orders_controller.rb | 4 ++-- app/lib/snail_mail/qr_code_generator.rb | 2 +- app/models/warehouse/batch.rb | 2 +- app/models/warehouse/order.rb | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/base_batches_controller.rb b/app/controllers/base_batches_controller.rb index a75418e..8cccc0f 100644 --- a/app/controllers/base_batches_controller.rb +++ b/app/controllers/base_batches_controller.rb @@ -65,7 +65,7 @@ class BaseBatchesController < ApplicationController @batch.run_map! rescue StandardError => e Rails.logger.warn(e) - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to send("#{@batch.class.name.split("::").first.downcase}_batch_path", @batch), flash: { alert: "error mapping fields! #{e.message} (error: #{event_id})" } return end diff --git a/app/controllers/letter/batches_controller.rb b/app/controllers/letter/batches_controller.rb index f0cb81e..cf90cee 100644 --- a/app/controllers/letter/batches_controller.rb +++ b/app/controllers/letter/batches_controller.rb @@ -128,7 +128,7 @@ class Letter::BatchesController < BaseBatchesController redirect_to letter_batch_path(@batch, print_now: letter_batch_params[:print_immediately]), notice: "Batch processed successfully" rescue => e - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to process_letter_batch_path(@batch), alert: "Failed to process batch: #{e.message} (error: #{event_id})" end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index f08fde4..d7adc0f 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -44,7 +44,7 @@ class SessionsController < ApplicationController @user = User.from_hack_club_auth(auth) rescue => e Rails.logger.error "Error creating user from Hack Club Auth: #{e.message}" - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to login_path, alert: "error authenticating! (error: #{event_id})" return end diff --git a/app/controllers/warehouse/batches_controller.rb b/app/controllers/warehouse/batches_controller.rb index 68a85b8..7f5017c 100644 --- a/app/controllers/warehouse/batches_controller.rb +++ b/app/controllers/warehouse/batches_controller.rb @@ -114,7 +114,7 @@ class Warehouse::BatchesController < BaseBatchesController @batch.run_map! rescue StandardError => e Rails.logger.warn(e) - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to warehouse_batch_path(@batch), flash: { alert: "Error mapping fields! #{e.message} (error: #{event_id})" } return end diff --git a/app/controllers/warehouse/orders_controller.rb b/app/controllers/warehouse/orders_controller.rb index 577b22a..2a6bd00 100644 --- a/app/controllers/warehouse/orders_controller.rb +++ b/app/controllers/warehouse/orders_controller.rb @@ -38,11 +38,11 @@ class Warehouse::OrdersController < ApplicationController begin @warehouse_order.dispatch! rescue Zenventory::ZenventoryError => e - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to @warehouse_order, alert: "zenventory said \"#{e.message}\" (error: #{event_id})" return rescue AASM::InvalidTransition => e - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id redirect_to @warehouse_order, alert: "couldn't dispatch order! wrong state? (error: #{event_id})" return end diff --git a/app/lib/snail_mail/qr_code_generator.rb b/app/lib/snail_mail/qr_code_generator.rb index 203b37c..6051f23 100644 --- a/app/lib/snail_mail/qr_code_generator.rb +++ b/app/lib/snail_mail/qr_code_generator.rb @@ -36,7 +36,7 @@ module SnailMail pdf.image io, at: [x, y], width: size, height: size rescue => e Rails.logger.error("QR code generation failed: #{e.message}") - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id pdf.text_box "QR Error (error: #{event_id})", at: [x, y], width: size, height: size end end diff --git a/app/models/warehouse/batch.rb b/app/models/warehouse/batch.rb index 433308f..d8eaf16 100644 --- a/app/models/warehouse/batch.rb +++ b/app/models/warehouse/batch.rb @@ -102,7 +102,7 @@ class Warehouse::Batch < Batch begin Zenventory.create_customer_order(update_hash) rescue Zenventory::ZenventoryError => e - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id errors.add(:base, "couldn't create order, Zenventory said: #{e.message} (error: #{event_id})") throw(:abort) end diff --git a/app/models/warehouse/order.rb b/app/models/warehouse/order.rb index e50e0c3..a488b4b 100644 --- a/app/models/warehouse/order.rb +++ b/app/models/warehouse/order.rb @@ -173,7 +173,7 @@ class Warehouse::Order < ApplicationRecord }.compact_blank Zenventory.update_customer_order(zenventory_id, update_hash) unless update_hash.empty? rescue Zenventory::ZenventoryError => e - event_id = Sentry.capture_exception(e) + event_id = Sentry.capture_exception(e)&.event_id errors.add(:base, "couldn't edit order, Zenventory said: #{e.message} (error: #{event_id})") throw(:abort) end