1 11 package org.eclipse.swt; 12 13 import org.eclipse.swt.internal.*; 14 15 31 32 public class SWTException extends RuntimeException { 33 36 public int code; 37 38 42 public Throwable throwable; 43 44 static final long serialVersionUID = 3257282552304842547L; 45 46 51 public SWTException () { 52 this (SWT.ERROR_UNSPECIFIED); 53 } 54 55 63 public SWTException (String message) { 64 this (SWT.ERROR_UNSPECIFIED, message); 65 } 66 67 73 public SWTException (int code) { 74 this (code, SWT.findErrorText (code)); 75 } 76 77 86 public SWTException (int code, String message) { 87 super (message); 88 this.code = code; 89 } 90 91 103 public Throwable getCause() { 104 return throwable; 105 } 106 107 115 public String getMessage () { 116 if (throwable == null) return super.getMessage (); 117 return super.getMessage () + " (" + throwable.toString () + ")"; } 119 120 128 public void printStackTrace () { 129 super.printStackTrace (); 130 if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0) && throwable != null) { 131 System.err.println ("*** Stack trace of contained exception ***"); throwable.printStackTrace (); 133 } 134 } 135 136 } 137 138 139 | Popular Tags |