package com.yfd.platform.exception;

import org.springframework.util.StringUtils;

/**
 * @Date 2021/1/26 9:07
 * @Version 1.0
 */
public class ChildrenExistException extends RuntimeException{

    public ChildrenExistException(Class clazz, String field, String val) {
        super(ChildrenExistException.generateMessage(clazz.getSimpleName(), field, val));
    }

    private static String generateMessage(String entity, String field, String val) {
        return StringUtils.capitalize(entity)
                + " with " + field + " "+ val + " Children Exist";
    }
}
