-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomRuntimeException.java
More file actions
26 lines (22 loc) · 919 Bytes
/
CustomRuntimeException.java
File metadata and controls
26 lines (22 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.app.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public class CustomRuntimeException extends RuntimeException {
private final String responseCode; // Unique error code
private final HttpStatus httpStatus; // HTTP status associated with the exception
private final Object[] args;
/**
* Constructor for CustomRuntimeException.
*
* @param responseCode The unique error code.
* @param httpStatus The HTTP status associated with the exception.
* @param args Arguments for dynamic message formatting.
*/
public CustomRuntimeException(String responseCode, HttpStatus httpStatus, Object... args) {
super(responseCode); // Use responseCode as the default message for the exception
this.responseCode = responseCode;
this.httpStatus = httpStatus;
this.args = args;
}
}