From bf041d8eedf787548b07657ec905ac69c747a966 Mon Sep 17 00:00:00 2001 From: AlexBob Date: Thu, 2 Jan 2025 12:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(`RestServerException.java`):?= =?UTF-8?q?=20Add=20detailed=20Javadoc=20comments=20and=20static=20factory?= =?UTF-8?q?=20methods=20for=20constructing=20`RestServerException`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/RestServerException.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/boot/platform/src/main/java/com/plate/boot/commons/exception/RestServerException.java b/boot/platform/src/main/java/com/plate/boot/commons/exception/RestServerException.java index d1608b3e..257e7ade 100644 --- a/boot/platform/src/main/java/com/plate/boot/commons/exception/RestServerException.java +++ b/boot/platform/src/main/java/com/plate/boot/commons/exception/RestServerException.java @@ -28,19 +28,45 @@ @EqualsAndHashCode(callSuper = true) public class RestServerException extends ServerErrorException { - + /** + * Constructs a new RestServerException with the specified detail message and cause. + * + * @param reason the detail message (which is saved for later retrieval by the {@link Throwable#getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). + */ public RestServerException(String reason, Throwable cause) { super(reason, cause); } + /** + * Constructs a new RestServerException with the specified detail message, handler method, and cause. + * + * @param reason the detail message (which is saved for later retrieval by the {@link Throwable#getMessage()} method). + * @param handlerMethod the method that caused the exception. + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). + */ public RestServerException(String reason, Method handlerMethod, Throwable cause) { super(reason, handlerMethod, cause); } + /** + * Constructs a new RestServerException with the specified detail message, method parameter, and cause. + * + * @param reason the detail message (which is saved for later retrieval by the {@link Throwable#getMessage()} method). + * @param parameter the method parameter that caused the exception. + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). + */ public RestServerException(String reason, MethodParameter parameter, Throwable cause) { super(reason, parameter, cause); } + /** + * Creates a new RestServerException with the specified detail message and cause. + * + * @param reason the detail message. + * @param cause the cause. + * @return a new instance of RestServerException. + */ public static RestServerException withMsg(String reason, Throwable cause) { var ex = new RestServerException(reason, cause); ex.setTitle(reason); @@ -49,10 +75,26 @@ public static RestServerException withMsg(String reason, Throwable cause) { return ex; } + /** + * Creates a new RestServerException with the specified detail message, handler method, and cause. + * + * @param reason the detail message. + * @param handlerMethod the method that caused the exception. + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). + * @return a new instance of RestServerException. + */ public static RestServerException withMsg(String reason, Method handlerMethod, @Nullable Throwable cause) { return new RestServerException(reason, handlerMethod, cause); } + /** + * Creates a new RestServerException with the specified detail message, method parameter, and cause. + * + * @param reason the detail message. + * @param parameter the method parameter that caused the exception. + * @param cause the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). + * @return a new instance of RestServerException. + */ public static RestServerException withMsg(String reason, MethodParameter parameter, Throwable cause) { return new RestServerException(reason, parameter, cause); }