Refined log and exception message.
@@ -10,6 +10,10 @@ public class DalException extends SQLException{
super(reason);
}
+ public DalException(String reason, Throwable e) {
+ super(reason, e);
+ }
+
public DalException(ErrorCode error) {
super(error.getMessage());
this.errorCode = error;
@@ -19,6 +23,7 @@ public class DalException extends SQLException{
super(error.getMessage() + e.getMessage(), e);
this.errorCode = error;
}
+
public DalException(ErrorCode error, Object... args) {
super(String.format(error.getMessage(), args));
this.errorCode = error;
@@ -35,7 +40,9 @@ public class DalException extends SQLException{
}
public static DalException wrap(Throwable e) {
- return e instanceof DalException ? (DalException)e: e.getCause() instanceof DalException ? (DalException)e.getCause(): new DalException(ErrorCode.Unknown, e, e.getMessage());
+ return e instanceof DalException ? (DalException) e
+ : e.getCause() instanceof DalException ? (DalException) e.getCause()
+ : new DalException(ErrorCode.Unknown, e, e.getMessage());
}
public static DalException wrap(ErrorCode defaultError, Throwable e) {
