Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spurt throws exception instead of returning failure on encoding issue #5970

Open
p6rt opened this issue Jan 3, 2017 · 1 comment
Open

spurt throws exception instead of returning failure on encoding issue #5970

p6rt opened this issue Jan 3, 2017 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Jan 3, 2017

Migrated from rt.perl.org#130489 (status was 'new')

Searchable as RT130489$

@p6rt
Copy link
Author

p6rt commented Jan 3, 2017

From @briandfoy

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant