summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/GLException.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLException.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLException.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java
index 6a287c969..15e9cddac 100644
--- a/src/jogl/classes/javax/media/opengl/GLException.java
+++ b/src/jogl/classes/javax/media/opengl/GLException.java
@@ -41,7 +41,7 @@ package javax.media.opengl;
/** A generic exception for OpenGL errors used throughout the binding
as a substitute for {@link RuntimeException}. */
-
+@SuppressWarnings("serial")
public class GLException extends RuntimeException {
/** Constructs a GLException object. */
public GLException() {
@@ -65,4 +65,16 @@ public class GLException extends RuntimeException {
public GLException(final Throwable cause) {
super(cause);
}
+
+ /** Constructs a GLException object with the specified root
+ cause with a decorating message including the current thread name. */
+ public static GLException newGLException(final Throwable t) {
+ return new GLException("Caught "+t.getClass().getSimpleName()+": "+t.getMessage()+" on thread "+Thread.currentThread().getName(), t);
+ }
+
+ /** Dumps a Throwable in a decorating message including the current thread name, and stack trace. */
+ public static void dumpThrowable(final Throwable t) {
+ System.err.println("Caught "+t.getClass().getSimpleName()+": "+t.getMessage()+" on thread "+Thread.currentThread().getName());
+ t.printStackTrace();
+ }
}