1 11 package org.eclipse.swt; 12 13 import org.eclipse.swt.internal.*; 14 15 40 41 public class SWTError extends Error { 42 45 public int code; 46 47 51 public Throwable throwable; 52 53 static final long serialVersionUID = 3833467327105808433L; 54 55 60 public SWTError () { 61 this (SWT.ERROR_UNSPECIFIED); 62 } 63 64 72 public SWTError (String message) { 73 this (SWT.ERROR_UNSPECIFIED, message); 74 } 75 76 82 public SWTError (int code) { 83 this (code, SWT.findErrorText (code)); 84 } 85 86 95 public SWTError (int code, String message) { 96 super (message); 97 this.code = code; 98 } 99 100 112 public Throwable getCause() { 113 return throwable; 114 } 115 116 124 public String getMessage () { 125 if (throwable == null) return super.getMessage (); 126 return super.getMessage () + " (" + throwable.toString () + ")"; } 128 129 137 public void printStackTrace () { 138 super.printStackTrace (); 139 if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0) && throwable != null) { 140 System.err.println ("*** Stack trace of contained error ***"); throwable.printStackTrace (); 142 } 143 } 144 145 } 146 | Popular Tags |