0
在我的Grails应用程序我有一个自定义InvalidTokenException
如下:清洁自定义异常的消息
class InvalidTokenException extends Exception{
public InvalidTokenException() {}
public InvalidTokenException(String message)
{
super(message);
}
}
这我扔在我的服务如下:
throw new InvalidTokenException("Invalid token : '${word}'")
这我赶上在我的控制器和渲染到客户端如下:
catch(e)
{
//send the exception to the client for rendering an error message.
render(status: 400, text: e)
return false //stops further execution
}
虽然我想成为剥离bac k它只包含文本“Invalid token:word”的消息而不是“Exception uk.co.litecollab.exceptions.InvalidTokenException Invalid token:word”
任何想法如何做到这一点?
谢谢,工作完美。本来应该抓住这个,这是一个漫长的周末.. – 2013-04-28 14:54:41