package com.huimv.common.exception; public class MiException extends RuntimeException{ private ExceptionEnum exceptionEnum; public MiException(ExceptionEnum exceptionEnum){ this.exceptionEnum = exceptionEnum; } public ExceptionEnum getExceptionEnum(){ return exceptionEnum; } //用来输出异常信息和状态码 public void printException(MiException e){ ExceptionEnum exceptionEnum = e.getExceptionEnum(); System.out.println("异常代码:" + exceptionEnum.getCode() + ",异常信息:" + exceptionEnum.getMessage()); } }