The personal finance app for everyone
Capture webhook errors in Sentry
Zach Gollwitzer331de2f997a1
diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rbindex 56ce7c98..3f6af0e6 100644--- a/app/controllers/webhooks_controller.rb+++ b/app/controllers/webhooks_controller.rb@@ -11,6 +11,7 @@ class WebhooksController < ApplicationControllerrender json: { received: true }, status: :okrescue => error+ Sentry.capture_exception(error)render json: { error: "Invalid webhook: #{error.message}" }, status: :bad_requestend@@ -33,10 +34,12 @@ class WebhooksController < ApplicationControllerRails.logger.info "Unhandled event type: #{event.type}"end- rescue JSON::ParserError+ rescue JSON::ParserError => error+ Sentry.capture_exception(error)render json: { error: "Invalid payload" }, status: :bad_requestreturn- rescue Stripe::SignatureVerificationError+ rescue Stripe::SignatureVerificationError => error+ Sentry.capture_exception(error)render json: { error: "Invalid signature" }, status: :bad_requestreturnend