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.
rass/gtask/exception/ActionFailureException.java

42 lines
2.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.exception;
// ActionFailureException类继承自RuntimeException属于运行时异常通常用于表示在执行某个操作时出现失败情况的异常类型。
// 这样的设计使得在代码中不需要显式地去捕获它(当然也可以捕获进行更精细的处理),方便在业务逻辑中遇到操作失败场景时抛出,以提示调用者操作未能成功完成。
public class ActionFailureException extends RuntimeException {
// 用于实现Java序列化机制的版本号保证在序列化和反序列化过程中对象的兼容性这里是一个固定的长整型值。
private static final long serialVersionUID = 4425249765923293627L;
// 默认构造函数调用父类RuntimeException的默认构造函数不传入任何特定的错误信息创建一个简单的运行时异常实例。
public ActionFailureException() {
super();
}
// 构造函数接受一个字符串参数用于指定具体的错误信息内容调用父类RuntimeException的对应构造函数将错误信息传递给父类构造函数进行初始化。
// 这样在异常抛出后,调用者可以通过获取异常信息来了解操作失败的具体原因。
public ActionFailureException(String paramString) {
super(paramString);
}
// 构造函数接受一个字符串参数用于指定具体的错误信息内容和一个Throwable类型的参数表示导致当前异常的根源异常可能是另一个更低层的异常
// 调用父类RuntimeException的对应构造函数将错误信息和根源异常传递给父类构造函数进行初始化。
// 方便在异常传播过程中保留原始异常信息,便于更准确地进行问题排查和调试。
public ActionFailureException(String paramString, Throwable paramThrowable) {
super(paramString, paramThrowable);
}
}