diff --git a/src/CoreShop/Bundle/OrderBundle/Controller/OrderInvoiceController.php b/src/CoreShop/Bundle/OrderBundle/Controller/OrderInvoiceController.php
index 6ebba0cc31..f8d366cd07 100644
--- a/src/CoreShop/Bundle/OrderBundle/Controller/OrderInvoiceController.php
+++ b/src/CoreShop/Bundle/OrderBundle/Controller/OrderInvoiceController.php
@@ -187,8 +187,7 @@ public function renderAction(Request $request): Response
'Content-Disposition' => 'inline; filename="invoice-' . $invoice->getId() . '.pdf"',
];
} catch (\Exception $e) {
- $responseData = '' . $e->getMessage() . '
trace: ' . $e->getTraceAsString();
- $header = ['Content-Type' => 'text/html'];
+ return new Response('An error occurred while rendering the invoice.', 500, ['Content-Type' => 'text/html']);
}
return new Response($responseData, 200, $header);
diff --git a/src/CoreShop/Bundle/OrderBundle/Controller/OrderShipmentController.php b/src/CoreShop/Bundle/OrderBundle/Controller/OrderShipmentController.php
index c967b41552..644727b8d8 100644
--- a/src/CoreShop/Bundle/OrderBundle/Controller/OrderShipmentController.php
+++ b/src/CoreShop/Bundle/OrderBundle/Controller/OrderShipmentController.php
@@ -183,8 +183,7 @@ public function renderAction(Request $request): Response
'Content-Disposition' => 'inline; filename="shipment-' . $shipment->getId() . '.pdf"',
];
} catch (\Exception $e) {
- $responseData = '' . $e->getMessage() . '
trace: ' . $e->getTraceAsString();
- $header = ['Content-Type' => 'text/html'];
+ return new Response('An error occurred while rendering the shipment.', 500, ['Content-Type' => 'text/html']);
}
return new Response($responseData, 200, $header);