Skip to content

Commit 84de898

Browse files
committed
Add one remaining exception override
1 parent d30afcb commit 84de898

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/main/java/io/github/malczuuu/problem4j/core/ProblemException.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public ProblemException(String message, Problem problem) {
4545
* status code.
4646
*
4747
* @param problem the problem instance to associate with this exception
48-
* @param cause the root cause of this exception
48+
* @param cause the root cause of this exception (a {@code null} value is permitted, and indicates
49+
* that the cause is nonexistent or unknown)
4950
*/
5051
public ProblemException(Problem problem, Throwable cause) {
5152
super(produceExceptionMessage(problem), cause);
@@ -58,13 +59,38 @@ public ProblemException(Problem problem, Throwable cause) {
5859
*
5960
* @param message custom exception message
6061
* @param problem the problem instance to associate with this exception
61-
* @param cause the root cause of this exception
62+
* @param cause the root cause of this exception (a {@code null} value is permitted, and indicates
63+
* that the cause is nonexistent or unknown)
6264
*/
6365
public ProblemException(String message, Problem problem, Throwable cause) {
6466
super(message, cause);
6567
this.problem = problem;
6668
}
6769

70+
/**
71+
* Constructs a {@link ProblemException} with full control over exception properties.
72+
*
73+
* <p>This constructor allows specifying a custom message, associated {@link Problem}, a root
74+
* cause, and advanced options such as whether suppression is enabled and whether the stack trace
75+
* should be writable.
76+
*
77+
* @param message custom exception message
78+
* @param problem the problem instance to associate with this exception
79+
* @param cause the root cause of this exception (a {@code null} value is permitted, and indicates
80+
* that the cause is nonexistent or unknown)
81+
* @param enableSuppression whether suppression is enabled
82+
* @param writableStackTrace whether the stack trace should be writable
83+
*/
84+
protected ProblemException(
85+
String message,
86+
Problem problem,
87+
Throwable cause,
88+
boolean enableSuppression,
89+
boolean writableStackTrace) {
90+
super(message, cause, enableSuppression, writableStackTrace);
91+
this.problem = problem;
92+
}
93+
6894
/**
6995
* Produces a string message for the exception based on the problem's title, detail, and status.
7096
*

0 commit comments

Comments
 (0)