Runner: don't prefix Ruleset error notices #841
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As things are, the
Runner
class catches any exception thrown by the Ruleset, enhances the message with anERROR
prefix, adds new lines and short help usage info and then re-throws this as aDeepExitException
.In an upcoming PR, a new
MsgCollector
class will be introduced, which will allow for both errors, as well as warnings, notices and deprecations.This means that the
ERROR
prefix won't always be appropriate anymore.This commit moves the
ERROR
prefix addition from theRunner
class to the individual messages for the Exceptions being thrown in theRuleset
class.Additionally, it changes the "trailing new lines" handling as the
MsgCollector
may also add new lines at the end of a message, as messages will not necessarily always be displayed via an exception (think: non-blocking deprecation notices). So to prevent a duplicate set of new lines, any new lines which are included in the exception are trimmed off before adding the new lines desired for the Exception display.This is a preliminary step before introducing the
MsgCollector
to theRuleset
class.Suggested changelog entry
N/A - This is an internal change only
Related issues/external references
Loosely related to #689