php - FOSRestBundle: show my custom exception message -


I am trying to add a custom control of exceptions in FOSRestBundle, but it is ignoring my custom messages ( This situation's code response is fine).

I have:

  New HTTP Exception (404, "User {$ ID} not found");  

But get this Jason response:

  {"error": {"code": 404, "message": "did not get"}}  

So I do not get a way to show my custom message

You can also add exceptions to the following configurations:

  fos_rest: exception: code: 'my \ custom \ notfound \ exceptioncase404': 404 Message: 'My custom' \ NotFound \ exception 404 ': Correct  

Provide a custom message in your exception class And it should work as expected.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -