/** * Converts an exception to ModificationException or InvalidValueException depending on whether * t implements {@link Expectable}. * * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, int code, Object fmtArg) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, code, fmtArg); return (ModificationException) Exceptions.wrap(t, ModificationException.class, code, fmtArg); }
/** * Converts an exception to ModificationException or InvalidValueException depending on whether * t implements {@link Expectable}. * * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, String msg) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, msg); return (ModificationException) Exceptions.wrap(t, ModificationException.class, msg); }