You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MVC/StudentNotFoundException.java

35 lines
745 B

package com.studentmanagement.exception;
/**
* 学生未找到异常
* 当尝试访问不存在的学生记录时抛出
*/
public class StudentNotFoundException extends Exception {
private String studentId;
/**
* 构造函数
* @param message 异常消息
* @param studentId 学生ID
*/
public StudentNotFoundException(String message, String studentId) {
super(message);
this.studentId = studentId;
}
/**
* 构造函数
* @param message 异常消息
*/
public StudentNotFoundException(String message) {
super(message);
}
/**
* 获取学生ID
* @return 学生ID
*/
public String getStudentId() {
return studentId;
}
}