GWT异常getLocalizedMessage()

GWT异常getLocalizedMessage(),gwt,Gwt,任何人现在都知道它将返回什么消息,大多数时候我看到的是空的或空的。GWT为此提供了什么类型的实现 我正在尝试使用日志将UI端错误记录到日志中。你好,charankumar,即使我没有从异常中获得任何信息。getLocalizedMessage() 所以我使用了exception.toString()来代替它。它将为您提供异常类型(例如NullPointerException,ClassCastException,IndexOutOfBoundsException等) 此外,如果有一些字符串作为l

任何人现在都知道它将返回什么消息,大多数时候我看到的是空的或空的。GWT为此提供了什么类型的实现


我正在尝试使用日志将UI端错误记录到日志中。

你好,charankumar,即使我没有从
异常中获得任何信息。getLocalizedMessage()

所以我使用了
exception.toString()
来代替它。它将为您提供
异常类型
(例如
NullPointerException
ClassCastException
IndexOutOfBoundsException
等)


此外,如果有一些字符串作为localizedMessage,它也会返回给您。

查看JavaDoc和。正如您所看到的,后者的语义是:

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()
也应该不返回任何内容,或者本地化版本确实被覆盖(或者实施不遵循合同,这也是很可能的)


干杯,

你是说
java.lang.Exception.getLocalizedMessage()
?是的,在catch block e中。getLocalizedMessage()异常。getMessage()有帮助吗?是的,谢谢你的快速响应,我想知道一些想法,因为我也尝试了不同的选项