[gogoego] r3716 committed - error decoder hides the pain of getting the HTTP error code from a ser...

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 3, 2010, 2:30:09 PM8/3/10
to gog...@googlegroups.com
Revision: 3716
Author: carl....@solertium.com
Date: Tue Aug 3 11:29:19 2010
Log: error decoder hides the pain of getting the HTTP error code from a
server callback failure
http://code.google.com/p/gogoego/source/detail?r=3716

Added:

/trunk/modules/com.solertium.lwxml/src/com/solertium/lwxml/shared/utils/NativeDocumentErrorDecoder.java

=======================================
--- /dev/null
+++
/trunk/modules/com.solertium.lwxml/src/com/solertium/lwxml/shared/utils/NativeDocumentErrorDecoder.java
Tue Aug 3 11:29:19 2010
@@ -0,0 +1,20 @@
+package com.solertium.lwxml.shared.utils;
+
+import com.solertium.lwxml.shared.GWTResponseException;
+
+public class NativeDocumentErrorDecoder {
+
+ public static boolean isErrorCode(Throwable caught, int... code) {
+ if ((!(caught instanceof GWTResponseException)) || code.length == 0)
+ return false;
+
+ int errorCode = ((GWTResponseException)caught).getCode();
+
+ for (int current : code)
+ if (current == errorCode)
+ return true;
+
+ return false;
+ }
+
+}

Reply all
Reply to author
Forward
0 new messages