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

feat: nicer error messages during development #409

Merged
merged 1 commit into from
Apr 27, 2024
Merged

feat: nicer error messages during development #409

merged 1 commit into from
Apr 27, 2024

Conversation

hamirmahal
Copy link
Contributor

fixes #408.

@hamirmahal
Copy link
Contributor Author

Without this change

   Compiling numbat v1.11.0 (/home/hamir/numbat/numbat)
    Finished test [unoptimized + debuginfo] target(s) in 2.23s
     Running tests/interpreter.rs (target/debug/deps/interpreter-86e93d4b0103f0db)

running 1 test
thread 'test_algebra' panicked at numbat/tests/common.rs:27:21:
called `Result::unwrap()` on an `Err` value: ResolverError(ParseErrors([ParseError { kind: ExpectedThen, span: Span { start: SourceCodePositition { byte: 1029, line: 45, position: 22 }, end: SourceCodePositition { byte: 1054, line: 45, position: 47 }, code_source_id: 10 } }, ParseError { kind: ExpectedPrimary, span: Span { start: SourceCodePositition { byte: 1079, line: 46, position: 3 }, end: SourceCodePositition { byte: 1083, line: 46, position: 7 }, code_source_id: 10 } }]))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test test_algebra ... FAILED

failures:

failures:
    test_algebra

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 31 filtered out; finished in 0.00s

error: test failed, to rerun pass `-p numbat --test interpreter`

 *  The terminal process "cargo 'test', '--package', 'numbat', '--test', 'interpreter', '--', 'test_algebra', '--exact', '--nocapture'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

image

@hamirmahal
Copy link
Contributor Author

With this change

   Compiling numbat v1.11.0 (/home/hamir/numbat/numbat)
    Finished test [unoptimized + debuginfo] target(s) in 2.14s
     Running tests/interpreter.rs (target/debug/deps/interpreter-86e93d4b0103f0db)

running 1 test
thread 'test_algebra' panicked at numbat/tests/common.rs:29:21:

--------------------------------------------------------------------------------
Error
Expected 'then' in if-then-else condition
Expected one of: number, identifier, parenthesized expression
--------------------------------------------------------------------------------

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test test_algebra ... FAILED

failures:

failures:
    test_algebra

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 31 filtered out; finished in 0.00s

error: test failed, to rerun pass `-p numbat --test interpreter`

 *  The terminal process "cargo 'test', '--package', 'numbat', '--test', 'interpreter', '--', 'test_algebra', '--exact', '--nocapture'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

image

Copy link
Contributor Author

@hamirmahal hamirmahal left a comment

Choose a reason for hiding this comment

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

I'm definitely open to suggestions here. Anything that makes debugging easier is a win, I think.

@sharkdp
Copy link
Owner

sharkdp commented Apr 27, 2024

Thank you!

@sharkdp sharkdp merged commit 9717e21 into sharkdp:master Apr 27, 2024
15 checks passed
@hamirmahal
Copy link
Contributor Author

You're welcome!

@hamirmahal hamirmahal deleted the feat/nicer-error-messages-during-development branch April 27, 2024 19:04
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.

Errors while developing aren't very human-readable
2 participants