I want to delete "trace" from the exception response.
In my code i have something like this:
throw new \Magento\Framework\Exception\LocalizedException(__('You have already bought this item.'));
The response i get:
{"message": "You have already bought this item.",
"trace": "#0 /home/franco/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Padi\\Cart\\Model\\Observer\\SetProduct->execute(Object(Magento\\Framework\\Event\\Observer))\n#1 /home/franco/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\\Framework\\Event\\Invoker\\InvokerDefault->_callObserverMethod(Object(Padi\\Cart\\Model\\Observer\\SetProduct), Object(Magento\\Framework\\Event\\Observer))\n#2 /home/franco/magento2/vendor/magento/framework/Event/Manager.php(66): Magento\\Framework\\Event\\Invoker\\InvokerDefault->dispatch(Array, Object(Magento\\Framework\\Event\\Observer))\n#3 /home/franco/magento2/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\\Framework\\Event\\Manager->dispatch('sales_quote_ite...', Array)\n#4 /home/franco/magento2/vendor/magento/module-quote/Model/Quote/Item.php(431): Magento\\Framework\\Event\\Manager\\Proxy->dispatch('sales_quote_ite...', Array)\n#5 /home/franco/magento2/vendor/magento/module-quote/Mod"
..}
Thanks!