Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce $*WARNINGS and ENV<RAKU_WARNINGS>
- Introduces 4 new classes that provide different behaviours for warnings - CX::Warn::Quietly - do *not* show warnings, similar to quietly - CX::Warn::Fatal - immediately throw a warning as an exception - CX::Warn::Verbose - immediately show warnings with complete backtrace - CX::Warn::Collect - collect warnings until END, then show with frequencies The behaviour can be set by setting the new dynamic variable $*WARNINGS to any of these classes (CX::Warn for normal behaviour). The default behaviour of a process can be set with the RAKU_WARNINGS environment variable, which should have any of "quietly", "fatal", "verbose", or "collect" specified. No specification defaults to the current behaviour. Custom behaviour can also be made by creating one's own CX::Warn::Foo class, which should have a WARN method taking the warning message. That method is then expected to do the right thing, and return Nil. Such custom classes can also be activated with RAKU_WARNINGS=foo. Sadly this does *not* cover warnings that are not generated with the "warn" command. This would require some additional work, pointers and suggestions welcome. I also tried making this a v6.e feature only, but that ran into all sorts of scoping issues. So until these are better understood, this is now implemented as a 6.c feature.
- Loading branch information
Showing
3 changed files
with
70 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters