Skip to content

Commit

Permalink
bug(minimessage): respect requests to include stacktraces
Browse files Browse the repository at this point in the history
fixes #873
  • Loading branch information
kashike committed Feb 12, 2023
1 parent b108c73 commit 42ea3df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ protected ParsingException(final @Nullable String message, final @Nullable Throw
super(message, cause);
}

/**
* Create a new parsing exception with a message and an optional cause.
*
* @param message a detail message describing the error
* @param cause the cause
* @param enableSuppression whether suppression is enabled or disabled
* @param writableStackTrace whether the stack trace should be writable
* @since 4.13.0
*/
protected ParsingException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

/**
* Get the input message which caused this exception.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class ParsingExceptionImpl extends ParsingException {

private final String originalText;
private Token @NotNull [] tokens;
private final boolean withStackTrace;

/**
* Create a new parsing exception.
Expand All @@ -55,10 +54,9 @@ public ParsingExceptionImpl(
final @Nullable String originalText,
final @NotNull Token @NotNull ... tokens
) {
super(message);
super(message, null, true, false);
this.tokens = tokens;
this.originalText = originalText;
this.withStackTrace = false;
}

/**
Expand All @@ -78,10 +76,9 @@ public ParsingExceptionImpl(
final boolean withStackTrace,
final @NotNull Token @NotNull ... tokens
) {
super(message, cause);
super(message, cause, true, withStackTrace);
this.tokens = tokens;
this.originalText = originalText;
this.withStackTrace = withStackTrace;
}

@Override
Expand Down Expand Up @@ -148,14 +145,6 @@ private String arrow() {
return new String(chars);
}

@Override
public synchronized Throwable fillInStackTrace() {
if (this.withStackTrace) {
return super.fillInStackTrace();
}
return this;
}

@Override
public int startIndex() {
if (this.tokens.length == 0) return LOCATION_UNKNOWN;
Expand Down

0 comments on commit 42ea3df

Please sign in to comment.