2012-10-29 44 views
0

任何人现在会返回什么消息,大部分时间我看到空或空。 GWT为此提供了什么类型的实现。GWT异常getLocalizedMessage()

我试图用来记录UI方面的错误。

+0

你说关于'java.lang.Exception.getLocalizedMessage()'? – RAS

+0

是在catch块e.getLocalizedMessage() – JAVAC

回答

0

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

所以我用exception.toString()而不是那个。它会给你类型的Exception(如NullPointerExceptionClassCastException,IndexOutOfBoundsException等)。

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

+0

如何exception.getMessage()是否有帮助? – JAVAC

+0

没有。它没有。 – RAS

+0

是的,我的谢谢你的快速反应,我有一些想法,因为我也尝试不同的选项可用于我 – JAVAC

0

看看JavaDoc herehere。正如你可以阅读后者的语义是:

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()也应该返回任何或本地化版本确实覆盖(或执行不遵守合同,这也极有可能)...

干杯,

+0

谢谢安德斯.. – JAVAC