All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nutz.dao.DaoException Maven / Gradle / Ivy

Go to download

Nutz, which is a collections of lightweight frameworks, each of them can be used independently

There is a newer version: 1.r.72
Show newest version
package org.nutz.dao;

@SuppressWarnings("serial")
public class DaoException extends RuntimeException {

    public DaoException(String message) {
        super(message);
    }

    public DaoException(Throwable cause) {
        super(cause);
    }

    public DaoException(String message, Throwable cause) {
        super(message, cause);
    }

    public static  DaoException create(T obj, String fieldName, String name, Exception e) {
        if (e instanceof DaoException)
            return (DaoException) e;
        return new DaoException(String.format(    "Fail to %s [%s]->[%s], because: '%s'",
                                                name,
                                                obj == null ? "NULL object" : obj    .getClass()
                                                                                    .getName(),
                                                fieldName,
                                                null == e ? "" : e.getMessage()));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy