Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Color output of compile time errors.
  • Loading branch information
jnthn committed Dec 3, 2012
1 parent a109e73 commit cff96f1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/Exception.pm
Expand Up @@ -311,8 +311,13 @@ my role X::Comp is Exception {
has $.post;
multi method gist(::?CLASS:D:) {
if $.is-compile-time {
my $r = "===SORRY!===\n$.message at $.filename():$.line\n------> ";
$r ~= "$.pre\x[23CF]$.post";
my $color = %*ENV<RAKUDO_ERROR_COLOR> // $*OS ne 'MSWin32';
my ($red, $green, $yellow, $clear) = $color
?? ("\e[31m", "\e[32m", "\e[33m", "\e[0m")
!! ("", "", "", "");
my $eject = $*OS eq 'MSWin32' ?? "<HERE>" !! "\x[23CF]";
my $r = "$red==={$clear}SORRY!$red===$clear\n$.message\nat $.filename():$.line\n------> ";
$r ~= "$red$.pre$yellow$eject$green$.post$clear";
for @.modules.reverse[1..*] {
$r ~= $_<module>.defined
?? "\n from module $_<module> ($_<filename>:$_<line>)"
Expand Down

0 comments on commit cff96f1

Please sign in to comment.