# New Ticket Created by  "brian d foy" 
# Please include the string:  [perl #130489]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130489 >


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

Reply via email to