GWT异常getLocalizedMessage()

时间:2012-10-29 07:16:39

标签: gwt

任何人现在会返回什么信息,大多数时候我看到空或空。 GWT为此提供了什么类型的实施。

我尝试使用记录UI端错误来记录。

2 个答案:

答案 0 :(得分:0)

你好charankumar即使我没有从exception.getLocalizedMessage()得到任何东西。

所以我使用exception.toString()而不是那个。它会为您提供Exception的类型(例如NullPointerExceptionClassCastExceptionIndexOutOfBoundsException等。)

另外如果有一些字符串作为localizedMessage,它也会返回你。

答案 1 :(得分:0)

查看JavaDoc here here。你可以阅读后者的语义:

Creates a localized description of this throwable. Subclasses may override 
this method in order to produce a locale-specific message. For subclasses
that do not override this method, the default implementation returns the 
same result as getMessage()

基本上,这意味着您必须查看特定的异常以确定本地化消息可能是什么或意味着什么,并且如果您什么都没有,那么.getMessage()也应该不返回任何内容或者本地化版本确实被覆盖(或者实现不遵循合同,这也很可能)......

干杯,