1 21 package com.db4o.inside; 22 23 import com.db4o.*; 24 import com.db4o.ext.*; 25 26 29 public class Exceptions4 { 30 31 public static final void throwRuntimeException (int code) { 32 throwRuntimeException(code, null, null); 33 } 34 35 public static final void throwRuntimeException (int code, Throwable cause) { 36 throwRuntimeException(code, null, cause); 37 } 38 39 public static final void throwRuntimeException (int code, String msg) { 40 throwRuntimeException(code, msg, null); 41 } 42 43 public static final void throwRuntimeException (int code, String msg, Throwable cause) { 44 throwRuntimeException(code, msg, cause, true); 45 } 46 47 public static final void throwRuntimeException (int code, String msg, Throwable cause,boolean doLog) { 48 if(doLog) { 49 Messages.logErr(Db4o.configure(), code,msg, cause); 50 } 51 throw new Db4oException(Messages.get(code, msg)); 52 } 53 54 57 public static final void notSupported(){ 58 throwRuntimeException(53); 59 } 60 61 public static final void catchAllExceptDb4oException(Throwable exc) throws Db4oException { 62 if(exc instanceof Db4oException) { 63 throw (Db4oException)exc; 64 } 65 } 66 67 public static RuntimeException shouldNeverBeCalled(){ 68 throw new RuntimeException (); 69 } 70 71 public static RuntimeException shouldNeverHappen(){ 72 throw new RuntimeException (); 73 } 74 75 public static RuntimeException virtualException(){ 76 throw new RuntimeException (); 77 } 78 } 79 | Popular Tags |