Skip to content

Parse Java stack traces into structured Sentry exception.values entries #44

Description

@DiscountDarcy

Summary

Add support for parsing Java stack traces from CFML/BoxLang exceptions and sending them as structured exception entries in Sentry's exception.values array, giving proper frame-by-frame navigation in the Sentry UI.

Detailed Description

Currently, when showJavaStackTrace is enabled, the Java stack trace is appended to extra as a raw text blob. This makes it difficult to navigate in Sentry's UI — you can't click through frames, see in-app vs. framework distinction, or use Sentry's exception chaining.This feature parses the raw Java stack trace string into Sentry's structured exception.values format, where each exception (including Caused by: chains and Suppressed: exceptions) becomes a separate entry with properly attributed frames.

Each frame includes:

function: fully qualified class.method
filename: source file (e.g. MyClass.java)
lineno: line number (0 for Native Method)
in_app: heuristic based on class prefix (excludes java., javax., jakarta., sun., com.sun., org.apache., org.springframework., org.hibernate., lucee., boxlang.)

Possible Implementation Ideas

The implementation adds three private methods to SentryService.cfc:

parseJavaStackTrace(stackTrace) — parses raw Java stack trace string into structured exception values
_buildJavaExceptionValue(type, value, frames) — builds a Sentry exception value struct
_buildJavaFrame(className, method, fileName, lineNumber) — builds a Sentry stacktrace frame

The captureException() method is modified to append parsed Java exceptions to exception.values when showJavaStackTrace=true.

New settings:

showJavaStackTrace (boolean, default: false) — when true, Java stack traces are parsed and sent as structured exception entries

Backwards compatibility: Fully backward compatible. The default is false, so existing users see no change. The removeTabsOnJavaStackTrace setting is retained but marked as deprecated/no-op (it previously controlled tab removal in the raw text blob, which is no longer used when showJavaStackTrace=true).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions