Skip to content

be-js: report an unconfigured library instead of throwing - #613

Open
notactuallytreyanastasio wants to merge 1 commit into
temperlang:mainfrom
notactuallytreyanastasio:fix/js-run-unconfigured-library
Open

notactuallytreyanastasio wants to merge 1 commit into
temperlang:mainfrom
notactuallytreyanastasio:fix/js-run-unconfigured-library

Conversation

@notactuallytreyanastasio

Copy link
Copy Markdown
Contributor

temper run -b js looked the library up with getValue before
checking anything, so a --library that names no library, or one
whose config file does not parse, ended in an uncaught Kotlin
exception:

Exception in thread "main" java.util.NoSuchElementException: Key no-such-library is missing in the map.
    at lang.temper.be.js.RunJsKt.runJsBestEffort(RunJs.kt:69)

The metadata lookup right below it already returns a CliFailure for a
library the build does not know, as py, lua and java do. The
getValue threw first. A plain get lets that check run; the config
is only read for its library name, which is null-safe already.

Now:

## exception.msg: No JS library name for RunLibraryRequest(libraryName=no-such-library, taskName=run)
Run failed

RunTest.runJsBackendUnknownLibrary runs the run input with a
library name it does not have. Before this change it fails with the
NoSuchElementException; after, the run reports failure.

Fixes #611.

Reproduction: 58-js-run-missing-library-crash/ in temper-issue-repros.

🤖 Generated with Claude Code

`temper run -b js` looked the library up with `getValue` before
checking anything, so a `--library` that names no library, or one
whose config file does not parse, ended in an uncaught Kotlin
exception:

    Exception in thread "main" java.util.NoSuchElementException: Key no-such-library is missing in the map.
        at lang.temper.be.js.RunJsKt.runJsBestEffort(RunJs.kt:69)

The metadata lookup right below it already returns a CliFailure for a
library the build does not know, as py, lua and java do. The
`getValue` threw first. A plain `get` lets that check run; the config
is only read for its library name, which is null-safe already.

Now:

    ## exception.msg: No JS library name for RunLibraryRequest(libraryName=no-such-library, taskName=run)
    Run failed

RunTest.runJsBackendUnknownLibrary runs the `run` input with a
library name it does not have. Before this change it fails with the
NoSuchElementException; after, the run reports failure.

Fixes temperlang#611.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Bobby Grayson <bobbbygrayson+github@gmail.com>

@mikesamuel mikesamuel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing over to the already established default path seems like a fine fix. Thanks for including a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants