Skip to content

Limit throwable messages independently of stack traces - #1141

Open
2748109647 wants to merge 1 commit into
logfellow:mainfrom
2748109647:codex/issue-1013-limit-throwable-messages
Open

2748109647 wants to merge 1 commit into
logfellow:mainfrom
2748109647:codex/issue-1013-limit-throwable-messages

Conversation

@2748109647

Copy link
Copy Markdown

Large exception messages can consume ShortenedThrowableConverter.maxLength before any frames are rendered. Add opt-in maxErrorMessageLength, applied to outer, cause and suppressed messages in either order. Defaults remain unlimited; -1 resets the limit. Existing total trace limits, the getMessage extension hook, and OMIT_THROWABLE_MESSAGE are preserved.

The per-message limit includes the ellipsis, supports small limits, and avoids splitting surrogate pairs. README explains configuration and scope: class names/prefixes are outside this budget, so no fixed frame budget is guaranteed.

Validation on Windows/JDK 21, base main 29c1452:

  • mvn -Dtest=ShortenedThrowableConverterTest test: 35 passed, 0 failures/errors; Checkstyle 0 violations.
  • mvn verify: 633 tests, 6 failures. All six also fail on the unchanged base with mvn -Dtest=PrettyPrintingDecoratorTest,StackTraceJsonProviderTest test: five PrettyPrintingDecoratorTest assertions plus StackTraceJsonProviderTest.testWriteAsArray (formatting expectations). Full verify is not passing in this environment.
  • mvn -DskipTests verify: BUILD SUCCESS; packaging/validation with tests skipped.
  • git diff --check: passed.

Fixes #1013

Add an opt-in per-message character budget to preserve frames when

exception messages are large. Cover causes, suppressed exceptions,

small limits, omitted messages and surrogate boundaries.

Fixes logfellow#1013

Signed-off-by: Alpha <2748109647@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support max length setting on exception message (to be used with ShortenedThrowableConverter.maxLength)

1 participant