Quote: Is it possible to return a json in an exception in the API Response Trait in the production environment?
<?phpnamespace App\Controllers;use CodeIgniter\API\ResponseTrait;use Exception;class Home extends BaseController{ use ResponseTrait; public function index() { try { throw new Exception('Exception.'); } catch (Exception $e) { return $this->failServerError('Server Error.'); } }}
bash-3.2$ curl http://localhost:8080/ {"status":500,"error":500,"messages":{"error":"Server Error."}}