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

[DISCARDED] RFC: WIP: More detailed error reporting (reporting full failed expressions) #100

Closed
wants to merge 1 commit into from

Conversation

stanislaw
Copy link
Contributor

@stanislaw stanislaw commented Mar 31, 2023

Hello,

This is our (@mettta and @stanislaw) attempt to make a step towards more precise error reporting.

This slightly more simple implementation at first sacrifices some of the previous capabilities, such as "not reporting the whole failed expression, but only it's failed part". However, these capabilities can be implemented outside the _nm_raise method.

I would be curious to hear from you if you consider this to be going to the right direction. In the meantime, I would like to focus on implementing this capability given the direction taken in this patch:

def test_optional_with_better_match():
    ...
    # The reporting capability has degraded because we are printing the whole
    # failed expression but an optimization is possible within the parsing code
    # of Sequence.
    #     assert "Expected 'five'" in str(e.value)
    #     assert (e.value.line, e.value.col) == (1, 20)
    assert "Expected (('one' AND 'two' AND 'three' AND '4') OR Optional(('one' AND 'two' AND 'three' AND 'four' AND 'five')))" in str(e.value)
    assert (e.value.line, e.value.col) == (1, 1)

Code review checklist

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly
  • Changelog(s) has/have been updated, as needed (see CHANGELOG.md, no need
    to update for typo fixes and such).

# ##########################################################################
# WIP: We have doubts about this behavior. To our understanding,
# the parsing of OrderedChoice should not throw.
# ##########################################################################
Copy link
Member

Choose a reason for hiding this comment

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

You are right. There has already been a related discussion in #96. The issue also influence #98. I started working it.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the contribution @mettta and @stanislaw. I think you are heading in the right direction but there is an issue that you have noticed (and was reported recently in #96) that needs to be handled before your work is integrated. I'm working on it and will do a detailed review of this PR when finished.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, I just finished the work I've mentioned. Please rebase both your PRs on the master to see if everything works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will rebase in just a few minutes. We are preparing one small commit on top of this patch that makes all previous tests pass as they were in the master branch (reporting only the non-matched expressions in a non-matched expression, not the whole expression). We are fixing the remaining tests and don't know yet how long this should take.

Copy link
Member

Choose a reason for hiding this comment

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

Excellent. Thanks a lot! Just take your time. Nothing urgent here :)

stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 1, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 2, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 2, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 2, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 2, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 6, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 7, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 7, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 7, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 8, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 8, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 9, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 9, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 9, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
@stanislaw stanislaw changed the title RFC: WIP: More detailed error reporting RFC: WIP: More detailed error reporting (reporting full failed expressions) Apr 9, 2023
@stanislaw
Copy link
Contributor Author

Closing this in favour of the more advanced (and correct) #102.

@stanislaw stanislaw closed this Apr 9, 2023
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 9, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 9, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
stanislaw added a commit to stanislaw/Arpeggio that referenced this pull request Apr 10, 2023
This patch is more advanced compared to textX#100

The NoMatch class is made smarter and tracks the exact match errors.
With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions.

For example, for `Sequence`, the `SequenceNoMatch` class collects
the failed expression as well as all previously matched (but failed) `Optional` expressions.

The naming of `*NoMatch` certainly introduces some redundancy in the class
names, however, without this measure I had hard time visualizing the
internal structure of the failed expression to be printed.

Open question:

- Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example:

```
assert (
    "Expected '4' at position (1, 15)"
    " or "
    "'five' at position (1, 20)" in str(e.value)
 )
```

The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to
control whether several `at position` strings have to be presented instead
of a single `at position` at the end of the inspection message.
@stanislaw stanislaw changed the title RFC: WIP: More detailed error reporting (reporting full failed expressions) [DISCARDED] RFC: WIP: More detailed error reporting (reporting full failed expressions) Apr 15, 2023
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