我在用Symfony 2.8
我有一个POST方法根。返回格式是json。
app_patient_create:
path: /
methods: [POST]
defaults:
_controller: App:Patient:create
_format: json
_angular_safe: true在这个根目录下的侦听器中,我有一个异常。
throw new Exception\MaxPointsException();这是自定义的例外:
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');
}
}在dev环境中,消息是返回:

但在环境保护方面却并非如此:

你知道为什么吗?
发布于 2018-10-09 11:25:41
我使用HTTP 409响应来识别我的异常。
https://stackoverflow.com/questions/52424580
复制相似问题