function put($id, $name)
{
try
{
product::put($id, $name);
}
catch(\util\BadNameException $e)
{
throw new RestException(400, "Please supply a better name.");
}
}
When returning the error message I also want to include the result of (array)product::getNamingConvention()
in the error. How can I do that?
I could just return a custom array with the error message and data, but I don't know how to set the status code to 400 in that case?
I'm using Restler 3.