Comments (7)
See the README for how to run the full tests. Do you have a suggestion of how to make this automatic for distributions?
from raku-template-mustache.
You could skip the tests that need them if the mustache specs aren't found.
from raku-template-mustache.
Fixed, thank you!
from raku-template-mustache.
Issue is not fixed, I can reproduce now with a fresh rakudo and panda build. It does not fail with OS X homebrew version This is perl6 version 2015.03 built on MoarVM version 2015.03
.
Although the CATCH block is being called, the program still aborts. Here is a simplified test case:
my @files;
try {
@files = dir('NONEXISTENT-DIR', :test(rx{ '.json' $ })).sort;
note "After dir() call, which returned ", @files.perl;
CATCH {
@files = (); # Doesn't matter if this is here or not
note "Caught an error reading nonexistent dir.";
}
}
# This isn't reached
say "OK, files is ", @files.perl;
And result:
tsmith@ganesha:~/local/src/p6/panda/.panda-work/1430350453_1 (master %=)
[17:53:25] &4 $ perl6 --version
This is perl6 version 2015.04-112-gbcf3f1c built on MoarVM version 2015.04-24-g6ef0f8f
tsmith@ganesha:~/local/src/p6/panda/.panda-work/1430350453_1 (master %=)
[17:53:33] &4 $ perl6 t.pl6
Caught an error reading nonexistent dir.
Failed to get the directory contents of '/Users/tsmith/local/src/p6/panda/.panda-work/1430350453_1/NONEXISTENT-DIR': chdir failed: Unknown system error
in method dir at src/gen/m-CORE.setting:19003
in sub dir at src/gen/m-CORE.setting:19322
in block <unit> at t.pl6:3
tsmith@ganesha:~/local/src/p6/panda/.panda-work/1430350453_1 !127 (master %=)
[17:53:49] &4 $ /usr/local/bin/perl6 --version
This is perl6 version 2015.03 built on MoarVM version 2015.03
tsmith@ganesha:~/local/src/p6/panda/.panda-work/1430350453_1 (master %=)
[17:53:55] &4 $ /usr/local/bin/perl6 t.pl6
After dir() call, which returned Array.new(Failure.new(exception => X::IO::Dir.new(path => "/Users/tsmith/local/src/p6/panda/.panda-work/1430350453_1/NONEXISTENT-DIR", os-error => "chdir failed: Unknown system error")))
OK, files is Array.new(Failure.new(exception => X::IO::Dir.new(path => "/Users/tsmith/local/src/p6/panda/.panda-work/1430350453_1/NONEXISTENT-DIR", os-error => "chdir failed: Unknown system error")))
from raku-template-mustache.
Putting a default { ... } block around the code inside the CATCH will fix it. This oversight was hidden by the fact that until recently, a 'try' didn't properly enforce 'use fatal', so your code would continue to run if it was a "soft" Failure, instead of an Exception.
As documented at http://design.perl6.org/S04.html#Exception_handlers , a CATCH is similar to a 'given' block, with the important difference that putting code directly in the block is not the same as having an actual default {}, because not "handling" the exception by an explicit when or default case will cause it to be rethrown. Hope that helps and makes sense. :)
from raku-template-mustache.
Since dir() produces a Failure, you don't even need a try/catch, you can do something like this:
my @files = given dir('NONEXISTENT-DIR', :test(rx{ '.json' $ })) {
when Failure {
note "Caught an error reading nonexistent dir.";
();
}
default {
.sort;
}
};
from raku-template-mustache.
Thank you, raydiak and moritz. Issue is actually fixed now, see a0bf17f.
from raku-template-mustache.
Related Issues (20)
- Not working after glr merge HOT 4
- Test fails on Windows as of 2016.11 HOT 3
- Build fails on Rakudo 2017.3-232-gfbc6697
- Template Mustache is test fails while installing Bailador HOT 1
- Weird ordering in rendered output HOT 1
- Template::Mustache fails to install/recognize dependencies HOT 3
- The digit 0 doesn't print HOT 1
- Tag names can only contain what is considered an <ident> HOT 1
- Content of section tags spills out HOT 2
- Triple Mustache doesn't work when the field name contains a minus HOT 2
- Failing to install with Rakudo master HOT 2
- Inheritance templates HOT 5
- Speed problems HOT 7
- Doubt about Mustache specification HOT 6
- Cannot install Template::Mustache with rakudo 2019.11 HOT 1
- Allow HTML escaping to be disabled HOT 1
- Can't install Template::Mustache HOT 2
- Crash when parallel render; not thread safe? Dies with X::HyperRace::Died in test case HOT 7
- Fails to install on windows HOT 2
- deprecation warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raku-template-mustache.