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

Improve error messages #449

Open
Garados007 opened this issue May 22, 2023 · 0 comments
Open

Improve error messages #449

Garados007 opened this issue May 22, 2023 · 0 comments

Comments

@Garados007
Copy link
Member

Garados007 commented May 22, 2023

All error messages are right now single-line and difficult to read and understand. The format has grown historically and is difficult to handle.

For example, the following code produces right now:

static Function TestCase()
    DoTest(1)
End
static Function DoTest(variable foo)
    INFO("should be zero")
    CHECK_EQUAL_VAR(0, foo)
    INFO("check waves")
    CHECK_EQUAL_WAVES({ 0 }, { foo })
End
  0 == 1: is false. Assertion "CHECK_EQUAL_VAR(0, foo)" failed in Foo#TestCase➔Foo#DoTest (TestProc, line 8➔12)
    ⓘ should be zero
  Assuming equality using mode WAVE_DATA for waves _free_ (0x8ac395a0) and _free_ (0x8ac39100); detailed: Waves difference:
Wave1: _free_ (0x8ac395a0)
Wave2: _free_ (0x8ac39100)
 Dimensions | Labels | Value |
------------|--------|-------|
 [0]        |        | 0     |
            |        | 1     |
: is false. Assertion "CHECK_EQUAL_WAVES({ 0 }, { foo })" failed in Foo#TestCase➔Foo#DoTest (TestProc, line 8➔14)
    ⓘ check waves

There is a lot to improve:

  1. Generate a multi-line stack trace with each function call on its own line
  2. Use more understandable error messages on the first line right after the error keyword WARN, CHECK or REQUIRE. If the error message has some data (e.g. the diff for *_EQUAL_WAVE) keep them on their own lines with some indicators.
  3. Keep error info on their own lines.

An example could be:

CHECK_EQUAL_VAR: 0 is not equal to 1
    ⓘ should be zero
    -> Foo#DoTest: TestProc:L12
       Foo#TestCase: TestProc:L8
CHECK_EQUAL_WAVES: WAVE_DATA failed
    ■ Wave1: _free_ (0x8ac395a0)
    ■ Wave2: _free_ (0x8ac39100)
    ■  Dimensions | Labels | Value |
    ■ ------------|--------|-------|
    ■  [0]        |        | 0     |
    ■             |        | 1     |
    ⓘ check waves
    -> Foo#DoTest: TestProc:L14
       Foo#TestCase: TestProc:L8

Not only can the log output in Igor or JUnit be improved with this change but the extended error reporting for Github Actions (#448) as well.

Look into MIES ASSERT for standardizing stacktrace output.
With this change, all messages for error reporting need to be reconsidered and brought into a uniform format.

@t-b t-b added this to the Version 1.11 milestone Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants