Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print message on package.json parse error #15

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

tennox
Copy link
Contributor

@tennox tennox commented Nov 12, 2024

Context: Missing comma in package.json

Current behaviour:

❯ tk dev
thread 'main' panicked at src/common/mod.rs:22:64:
called `Result::unwrap()` on an `Err` value: Error("expected `,` or `}`", line: 7, column: 5)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'tk dev' terminated by signal SIGABRT (Abort)

New:

❯ ~/dev/ext/task-keeper/target/debug/tk dev
thread 'main' panicked at src/runners/packagejson.rs:17:45:
called `Result::unwrap()` on an `Err` value: TK-202001: failed to parse package.json
├╴at src/common/mod.rs:24:51
│
╰─▶ expected `,` or `}` at line 7 column 5
    ╰╴at src/common/mod.rs:24:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm not happy that it prints the stacktrace location twice - but I don't manage to change that... I don't know error_stack crate enough. (took me a bit to get this working 😅 )
Maybe you have a better idea, but I thought at least some way that includes the TK-202001: failed to parse package.json would be good

@linux-china linux-china merged commit f8ded44 into linux-china:master Nov 14, 2024
7 checks passed
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.

2 participants