From: | brian d foy <brian.d.foy [...] gmail.com> |
Date: | Mon, 2 Jan 2017 19:53:16 -0500 |
To: | rakudobug [...] perl.org |
Subject: | spurt throws exception instead of returning failure on encoding issue |
On encoding failure, spurt throws an exception immediately instead
of returning a Failure (https://docs.perl6.org/routine/spurt):
my $path = $*SPEC.catfile( $*SPEC.tmpdir, $file );
unless my $rc = spurt $path, 'İstanbul', enc => 'iso-8859-1' {
my $e = $rc.exception;
put "unless: {$e.^name}: {$e.message}";
}
CATCH {
put "Caught {.^name}: {.message}";
}
I get the CATCH block instead of the unless:
Caught X::AdHoc: Error encoding Latin-1 string: could not encode
codepoint 304
Error encoding Latin-1 string: could not encode codepoint 304