Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Automatically detect Sentry and report API errors (#12108)

Damian Legawiecfc25c7b9f951
diff --git a/api/app/services/spree/api/error_handler.rb b/api/app/services/spree/api/error_handler.rb
index 51ee559153..ce2449097b 100644
--- a/api/app/services/spree/api/error_handler.rb
+++ b/api/app/services/spree/api/error_handler.rb
@@ -32,6 +32,7 @@ module Spree
def report_error(exception:, message:, opts:)
# overwrite this method in your application to support different error handlers
# eg. Sentry, Rollbar, etc
+ Sentry.capture_exception(exception) if defined?(Sentry)
success(exception: exception, message: message)
end