Handle UTF-8 characters in eval error messages

This commit is contained in:
Eelco Dolstra 2013-09-25 15:51:03 +02:00
parent a8db329839
commit e1c9e28589
2 changed files with 8 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package Hydra::Helper::AddBuilds;
use strict;
use feature 'switch';
use utf8;
use XML::Simple;
use IPC::Run;
use Nix::Store;
@ -291,6 +292,9 @@ sub evalJobs {
}
}
# Handle utf-8 characters in error messages. No idea why this works.
utf8::decode($_->{msg}) foreach @{$jobs->{error}};
return ($jobs, $nixExprInput, $errors);
}

View file

@ -2,6 +2,7 @@
use strict;
use feature 'switch';
use utf8;
use Hydra::Schema;
use Hydra::Plugin;
use Hydra::Helper::Nix;
@ -250,7 +251,9 @@ sub checkJobsetWrapped {
default { $bindings .= "..."; }
}
}
$msg .= "at `" . $error->{location} . "' [$bindings]:\n" . $error->{msg} . "\n\n";
$msg .=
($error->{location} ne "" ? "in job $error->{location}" : "at top-level") .
" [$bindings]:\n" . $error->{msg} . "\n\n";
}
setJobsetError($jobset, $msg);
}