WebSafe 3.7github.com
|
|
🏠
Skip to content

Fix error handling when rescript.json parsing fails#8067

Merged
cknitt merged 4 commits intorescript-lang:masterfrom
cknitt:fix-experimental-panic
Dec 8, 2025
Merged

Fix error handling when rescript.json parsing fails#8067
cknitt merged 4 commits intorescript-lang:masterfrom
cknitt:fix-experimental-panic

Conversation

@cknitt
Copy link
Member

@cknitt cknitt commented Dec 7, 2025

Fixes #8034, and also makes sure that the error message is helpful to the user (pointing to the error location).

I.e., instead of a panic with

Can't initialize build: Could not read rescript.json at /some/path

we'll now get a clean exit with

Could not initialize build: Could not read rescript.json at /some/path: Failed to parse rescript.json at experimental-features: invalid type: sequence, expected a map at line 33 column 27

@cknitt cknitt force-pushed the fix-experimental-panic branch from a15116a to 0fe97c6 Compare December 7, 2025 09:59
let mut build_state: build::build_types::BuildCommandState =
build::initialize_build(None, filter, show_progress, path, plain_output, warn_error)
.expect("Can't initialize build");
.with_context(|| "Could not initialize build")?;
Copy link
Member Author

@cknitt cknitt Dec 7, 2025

Choose a reason for hiding this comment

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

Message changed for consistency with the build command and other error messages.

@cknitt cknitt force-pushed the fix-experimental-panic branch from 0fe97c6 to c2184c0 Compare December 7, 2025 10:07
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 7, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@8067

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@8067

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@8067

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@8067

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@8067

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@8067

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@8067

commit: 170097d

@cknitt cknitt requested a review from Bushuo December 7, 2025 10:49
Copy link
Collaborator

@Bushuo Bushuo left a comment

Choose a reason for hiding this comment

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

Nice work :)

@cknitt cknitt merged commit e8380f1 into rescript-lang:master Dec 8, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants

Comments