standalone: prettify TopLevelComposer error reporting #438

Merged
sb10q merged 1 commits from pretty-standalone-error into master 2024-06-27 14:04:10 +08:00
Collaborator

Small change made to nac3standalone to pretty print errors when TopLevelComposer.start_analysis fails. This helps with development when running nac3standalone/demo/src/*.py.

Error messages currently look like:

thread 'main' panicked at nac3standalone/src/main.rs:343:35:
called `Result::unwrap()` on an `Err` value: {"Incorrect argument type for parameter other. Expected N, but got int32 at src/test_operator_error.py:2:14\n\nNotes:\n    N ∈ {float, ndarray[float, ndarray_ndims]}\n    ndarray_ndims ∈ {uint64}"}

This PR changes this to:

1 error(s) occurred during top level analysis.
=========== ERROR 1/1 ============
Incorrect argument type for parameter other. Expected N, but got int32 at src/test_operator_error.py:2:14

Notes:
    N ∈ {float, ndarray[float, ndarray_ndims]}
    ndarray_ndims ∈ {uint64}
==================================
thread 'main' panicked at nac3standalone/src/main.rs:354:9:
top level analysis failed

More importantly, the \n characters can now be printed properly.

Small change made to `nac3standalone` to pretty print errors when `TopLevelComposer.start_analysis` fails. This helps with development when running `nac3standalone/demo/src/*.py`. Error messages currently look like: ``` thread 'main' panicked at nac3standalone/src/main.rs:343:35: called `Result::unwrap()` on an `Err` value: {"Incorrect argument type for parameter other. Expected N, but got int32 at src/test_operator_error.py:2:14\n\nNotes:\n N ∈ {float, ndarray[float, ndarray_ndims]}\n ndarray_ndims ∈ {uint64}"} ``` This PR changes this to: ``` 1 error(s) occurred during top level analysis. =========== ERROR 1/1 ============ Incorrect argument type for parameter other. Expected N, but got int32 at src/test_operator_error.py:2:14 Notes: N ∈ {float, ndarray[float, ndarray_ndims]} ndarray_ndims ∈ {uint64} ================================== thread 'main' panicked at nac3standalone/src/main.rs:354:9: top level analysis failed ``` More importantly, the `\n` characters can now be printed properly.
lyken requested review from sb10q 2024-06-27 10:13:24 +08:00
lyken requested review from derppening 2024-06-27 10:13:53 +08:00
lyken force-pushed pretty-standalone-error from db760c32e2 to ca8459dc7b 2024-06-27 10:15:16 +08:00 Compare
derppening approved these changes 2024-06-27 13:46:12 +08:00
sb10q merged commit ca8459dc7b into master 2024-06-27 14:04:09 +08:00
sb10q deleted branch pretty-standalone-error 2024-06-27 14:04:13 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#438
No description provided.