1 package com.quadcap.sql; 2 3 40 41 import java.sql.SQLException ; 42 43 import antlr.RecognitionException; 44 45 import com.quadcap.util.Debug; 46 import com.quadcap.util.Util; 47 48 53 public class DbException extends RecognitionException { 54 Exception next = null; 55 56 public DbException(Exception e) { 57 super(e.toString()); 58 this.next = e; 59 } 60 61 public DbException(String s) { 62 super(s); 63 } 64 65 68 public static SQLException wrapThrowable(Throwable t) { 69 String st = null; 70 try { 71 st = t.toString(); 72 } catch (Throwable tt) { 73 try { 74 st = t.getClass().getName(); 75 } catch (Throwable ttt) { 76 st = "Unknown throwable"; 77 } 78 } 79 SQLException ex = new SQLException (st, "06008"); 80 SQLException e2 = new SQLException (Util.stackTrace(t, false), "06008"); 81 ex.setNextException(e2); 82 83 if (Trace.bit(1)) { 85 Debug.print(t); 86 } 87 return ex; 89 } 90 } 91 92 | Popular Tags |