0

I'm using Symfony 2.8

I have a POST method root. The return format is json.

app_patient_create:
path: /
methods: [POST]
defaults:
    _controller: App:Patient:create
    _format: json
    _angular_safe: true

In a Listener in this root, i have an exception.

throw new Exception\MaxPointsException();

This is the custom exception :

namespace App\Training\Exception;

class MaxPointsException extends \LogicException
{
    public function __construct()
    {
        parent::__construct('Vous avez atteint le nombre maximal de patients inclus dans votre offre découverte. Pour continuer à profiter du site, veuillez vous abonner');
    }
}

In dev environnement, the message is return :

enter image description here

But not in prod environnement :

enter image description here

Did you know why?

Bruno P.
  • 51
  • 6
  • 2
    only in dev mode full error message is returned, in prod mode only 500 (internal server error) is return to avoid the disclosure of sensitive information which could help a bad guy. make sure you return HTTP error messages which are validated. – LBA Sep 20 '18 at 12:17
  • Thank you, i use a HTTP 409 for recognize my exception. – Bruno P. Sep 20 '18 at 16:56

1 Answers1

0

I use an HTTP 409 reponse for recognize my exception.

Bruno P.
  • 51
  • 6