Skip to content

Make a pretty printer for errors #2

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

Closed
michaelboulton opened this issue Nov 8, 2017 · 9 comments
Closed

Make a pretty printer for errors #2

michaelboulton opened this issue Nov 8, 2017 · 9 comments

Comments

@michaelboulton
Copy link
Member

Something like the default pytest one:

https://github.com/pytest-dev/pytest/blob/master/_pytest/terminal.py#L126

We want it to print out the yaml that caused the failure, the line, the file, etc. Colourised would be nice of course.

@michaelboulton
Copy link
Member Author

Make it so each expected/request/verifier type has a log_fail which helpfully explains why it failed as well, or have some kind of pytest/user hook so it can do 'something' when it fails. At the moment it's essentially pointless

@ahopkins
Copy link

This would be awesome. The names are certainly a help, but I have taken to providing a sort of serial number in the name field so that I can easily identify where in my yaml the problem is. It is all manual right now, so it would be helpful if there was an easier way to track down the source of a failure.

Awesome work on this by the way, and thanks for open sourcing it!

@michaelboulton
Copy link
Member Author

I started this with some help from the Pytest people: pytest-dev/pytest#3586

The real issue is trying to present the code in a nice format and showing which errors were caused at which point. This involves getting the yaml for the stage, probably post-format, which is currently a bit difficult.

It might be easier to generate a big output log file and then just parse it.

@michaelboulton michaelboulton mentioned this issue Jun 20, 2018
@michaelboulton
Copy link
Member Author

Progress:

err2

@michaelboulton
Copy link
Member Author

@benhowes I was going to merge this into master and enable the 'new' reporting with a flag (eg --tavern-beta-rewrite-exceptions). I think the real 'big' step for this issue is to add metadata to exceptions so that we can highlight the line in the stage that failed for each error (in the case where there is multiple errors). Some note would go in the documentation about this, but also how it's a beta feature that might get changed in future.

@michaelboulton
Copy link
Member Author

Also, print out the 'formatted' stage if possible alongside the raw input stage.

@benhowes
Copy link
Member

@michaelboulton would it make sense for highlighting multiple errors to be a future feature? The current functionality is a big improvement on where we are at the moment, so it may make sense to get that out in a release. Printing the formatted stage alongside the raw one would be a big help for debugging too

@michaelboulton
Copy link
Member Author

Highlighting multiple errors is definitely a fairly big thing so that can be left until a later release.

@michaelboulton
Copy link
Member Author

This is now in 0.13.0 - use the --tavern-beta-new-traceback flag to enable it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants