Repository navigation
Split error formatting (tags to text) from error reporting (logging, html, etc.) - #292
Conversation
… into human readable format
for more information, see https://pre-commit.ci
…r, and ValidationResultFormatter
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
+ Coverage 89.82% 90.37% +0.54%
==========================================
Files 15 21 +6
Lines 1632 2120 +488
==========================================
+ Hits 1466 1916 +450
- Misses 166 204 +38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Also remove LoggingResultHandler.error_message and HtmlErrorHandler.error_message/tag_name
ValidationResultHandler.formatter
mrbean-bremen
left a comment
There was a problem hiding this comment.
Very nice, thanks a lot! Only a couple of minor suggestions.
| """Renders `TagError` and `ValidationResult` objects as human-readable text.""" | ||
|
|
||
| def __init__(self, dictionary: dict | None = None) -> None: | ||
| """Initialise the formatter. |
There was a problem hiding this comment.
Please use American English for consistence (yeah, I know...)
There was a problem hiding this comment.
I've begrudgingly changed it 🙂
There was a problem hiding this comment.
Probably not worth to duplicate the implementation here - you may just reference the new null handler.
There was a problem hiding this comment.
good point, I've removed it now
…andler definition in the docs
|
Thanks! |
|
Note that I just made a new release. |
Describe the changes
Closes #291
ValidationResultFormatterclass that is responsible for converting tag errors into a human-readable format. It haserror_messageandfailed_validation_messagemethods.LoggingResultHandler.error_message,LoggingResultHandler.failed_validation_message, andHtmlResultHandler.error_messageare now thin wrappers around the corresponding new methods. I've kept these method only to avoid introducing breaking changes.HtmlResultHandler.handle_failed_validation_startfunction to report that validation could not be performedNullValidationResultHandlerclass (same as is currently in the docs) just for convenience for usersNote, this does change the output of the
HtmlValidationResultHandler(it's more verbose, e.g.EnumValueNotAllowednow lists the allowed values, same as theLoggingValidationResultHandlerdoes.). I assumed these could be treated as fixes or improvements rather than breaking changes?Happy to break this PR up if there are too many changes here
Tasks