Skip to content

Two tests fail on BoxLang — e.message null for Java exceptions and for (var key in e) incompatible with BoxLang exception objects #43

Description

@DiscountDarcy

What are the steps to reproduce this issue?

Run the test suite on BoxLang 1.15+ (box testbox run with cfengine=boxlang).

What happens?

Two tests fail:

  1. can log Java exception (SentryTests.cfc:49)

getLogbox().getRootLogger().error( e.message, e );

When catching a Java exception (e.g. java.io.File.init(null)), e.message is null. BoxLang's Logger.error() requires a non-null message argument and throws:Required argument message is missing for function logMessageThis also fails on Lucee 5 — e.message is empty string on Lucee but null on BoxLang, and Logger.error() treats both as "missing" when forwarded via argumentCollection.Fix: e.message ?: "Java exception" (null-safe operator, works on all engines).

  1. can log exception with no tagContext (SentryTests.cfc:58-62)
for ( var key in e ) {    if ( key != "TagContext" ) {
        newE[ key ] = e[ key ];
    }
}

BoxLang exception objects don't support key iteration via for (var key in e). The only accessible field is errorCode; accessing other keys throws:The instance [CustomException] has no public field or inner class [...].

The allowed fields are [[errorCode]]

Fix: Replace with duplicate(e) + structDelete(newE, "TagContext"), which works on all engines.

What were you expecting to happen?

Both tests should pass on all supported engines (Lucee, Adobe ColdFusion, BoxLang).

What versions are you using?

Operating System: Ubuntu 24.04
Package Version: 2.1.6
CF Engine: BoxLang 1.15.0, Lucee 5.4.8

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