2012-10-29 37 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