fix: show flash error message if resolve pending product fails

This commit is contained in:
Lance Edgar 2024-06-18 16:07:07 -05:00
parent 231ca0363a
commit a0cd8835e0

View file

@ -2563,7 +2563,14 @@ class PendingProductView(MasterView):
app = self.get_rattail_app() app = self.get_rattail_app()
products_handler = app.get_products_handler() products_handler = app.get_products_handler()
kwargs = self.get_resolve_product_kwargs() kwargs = self.get_resolve_product_kwargs()
try:
products_handler.resolve_product(pending, product, self.request.user, **kwargs) products_handler.resolve_product(pending, product, self.request.user, **kwargs)
except Exception as error:
log.warning("failed to resolve product", exc_info=True)
self.request.session.flash(f"Resolve failed: {simple_error(error)}", 'error')
return redirect
return redirect return redirect
def get_resolve_product_kwargs(self, **kwargs): def get_resolve_product_kwargs(self, **kwargs):