Paul Wright
Paul Wright

Reputation: 455

Debug output showing in Laravel api

Using Laravel 5.1 and dingo/api with Fractal.

I am throwing an exception using HttpException and expect to see both my http status code and my message, however I am also getting debug output.

if ($paginator->total() == 0)
        {
            throw new \Symfony\Component\HttpKernel\Exception\HttpException('404', 'No properties found');
        }

Gives me the following output:-

{
  "message": "No properties found",
  "status_code": "404",
  "debug": {
    "line": 203,
    "file": "C:\\\\xampp\\\\htdocs\\\\laravel\\\\apiv3\\\\app\\\\Http\\\\Controllers\\\\api\\\\v1\\\\SearchController.php",
    "class": "Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\HttpException",
    "trace": [
      "#0 [internal function]: App\\\\Http\\\\Controllers\\\\Api\\\\v1\\\\SearchController->search()",
      "#1 C:\\\\xampp\\\\htdocs\\\\laravel\\\\apiv3\\\\vendor\\\\laravel\\\\framework\\\\src\\\\Illuminate\\\\Routing\\\\Controller.php(256): call_user_func_array(Array, Array)",

etc.

I have tried to turn off debug in my .env file, but it has no effect. I want to be able to turn debug code on or off. I'm sure its' something simple I'm missing.

Upvotes: 0

Views: 2090

Answers (2)

ImLeo
ImLeo

Reputation: 1003

If there is a key API_DEBUG in your .env, set it to false.

Upvotes: 1

Kiran LM
Kiran LM

Reputation: 1379

I think, in your config/app.php debug may set to true, change it to false

Upvotes: 0

Related Questions