Goktug Gokdogan has uploaded a new change for review.

  https://gwt-review.googlesource.com/3500


Change subject: Adds an accessor to original throwable from SerializableThrowable.
......................................................................

Adds an accessor to original throwable from SerializableThrowable.

This provides ability for client side code (e.g. a client log handler)
to look into the original throwable.

Change-Id: I6856ca06f85af0165eea5ff6ac3015081b579352
---
M user/src/com/google/gwt/core/shared/SerializableThrowable.java
1 file changed, 21 insertions(+), 1 deletion(-)



diff --git a/user/src/com/google/gwt/core/shared/SerializableThrowable.java b/user/src/com/google/gwt/core/shared/SerializableThrowable.java
index cbbd612..03e993e 100644
--- a/user/src/com/google/gwt/core/shared/SerializableThrowable.java
+++ b/user/src/com/google/gwt/core/shared/SerializableThrowable.java
@@ -55,6 +55,7 @@

   private String typeName;
   private boolean exactTypeKnown;
+  private transient Throwable originalThrowable;
   private StackTraceElement[] dummyFieldToIncludeTheTypeInSerialization;

   /**
@@ -95,7 +96,7 @@
   }

   /**
- * Return {@code true} if provided type name is the exact type of the throwable that is designed + * Return {@code true} if provided type name is the exact type of the throwable that is designated * by this instance. This can return {@code false} if the class metadata is not available in the * runtime. In that case {@link #getDesignatedType()} will return the type resolved by best-effort * and may not be the exact type; instead it can be one of the ancestors of the real type that
@@ -115,6 +116,24 @@
     return super.initCause(fromThrowable(cause));
   }

+  /**
+ * Set the original throwable that this serializable throwable is derived from. Note that, + * original throwable is kept in a transient field; that is it will not be transferred to server
+   * side.
+   */
+  public void setOriginalThrowable(Throwable originalThrowable) {
+    this.originalThrowable = originalThrowable;
+  }
+
+  /**
+ * Returns the original throwable that this serializable throwable is derived from. Note that, + * original throwable is kept in a transient field; that is; it will not be transferred to server
+   * side. In that case this method will return {@code null}.
+   */
+  public Throwable getOriginalThrowable() {
+    return originalThrowable;
+  }
+
   @Override
   public String toString() {
String type = exactTypeKnown ? typeName : (typeName + "(EXACT TYPE UNKNOWN)");
@@ -126,6 +145,7 @@
SerializableThrowable throwable = new SerializableThrowable(null, t.getMessage());
     throwable.setStackTrace(t.getStackTrace());
     throwable.initCause(t.getCause());
+    throwable.setOriginalThrowable(t);
     ThrowableTypeResolver.resolveDesignatedType(throwable, t);
     return throwable;
   }

--
To view, visit https://gwt-review.googlesource.com/3500
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6856ca06f85af0165eea5ff6ac3015081b579352
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <[email protected]>

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to