From afe5b77cb2dc536a96ace3b5f6c8c27ee162a19a Mon Sep 17 00:00:00 2001 From: jacky-qiao <1102127448@qq.com> Date: Sat, 28 Dec 2024 09:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A=EF=BC=88?= =?UTF-8?q?=E7=9C=9F=20=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/ActionFailureException.java | 17 ++++++++++++----- .../exception/NetworkFailureException.java | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java b/src/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java index 15504be..07b798b 100644 --- a/src/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java +++ b/src/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java @@ -14,20 +14,27 @@ * limitations under the License. */ -package net.micode.notes.gtask.exception; +package net.micode.notes.gtask.exception; // 定义该类所在的包 +/** + * ActionFailureException 是一个运行时异常,表示执行操作失败的情况。 + * 这个异常可以通过不同的构造函数来创建,允许提供详细的错误信息和导致异常的原因。 + */ public class ActionFailureException extends RuntimeException { - private static final long serialVersionUID = 4425249765923293627L; + private static final long serialVersionUID = 4425249765923293627L; // 序列化版本UID,用于序列化机制 + // 默认构造函数 public ActionFailureException() { - super(); + super(); // 调用父类的构造函数 } + // 带有错误信息的构造函数 public ActionFailureException(String paramString) { - super(paramString); + super(paramString); // 调用父类构造函数,传递错误信息 } + // 带有错误信息和根本原因的构造函数 public ActionFailureException(String paramString, Throwable paramThrowable) { - super(paramString, paramThrowable); + super(paramString, paramThrowable); // 调用父类构造函数,传递错误信息和原因 } } diff --git a/src/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java b/src/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java index b08cfb1..4ec8d96 100644 --- a/src/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java +++ b/src/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java @@ -14,20 +14,28 @@ * limitations under the License. */ -package net.micode.notes.gtask.exception; +package net.micode.notes.gtask.exception; // 定义包路径 +/** + * NetworkFailureException 是一个自定义异常类, + * 用于表示网络故障的相关异常情况。 + */ public class NetworkFailureException extends Exception { + // 序列版本UID,用于序列化 private static final long serialVersionUID = 2107610287180234136L; + // 默认构造函数 public NetworkFailureException() { - super(); + super(); // 调用父类的构造函数 } + // 带有消息的构造函数 public NetworkFailureException(String paramString) { - super(paramString); + super(paramString); // 调用父类的构造函数,传入异常消息 } + // 带有消息和原因的构造函数 public NetworkFailureException(String paramString, Throwable paramThrowable) { - super(paramString, paramThrowable); + super(paramString, paramThrowable); // 调用父类的构造函数,传入异常消息和原因 } -} +}