NAME
Text::Nunjucks::Lib::Error - Port representation of a JS built-in Error / TypeError (name + message)
VERSION
version 0.001
DESCRIPTION
A plain error with a name and a message. The engine throws it where JavaScript throws a built-in Error or TypeError (ADR 0010) and where Nunjucks throws new Error(...): template not found: NAME, filter not found: NAME, watch requires chokidar to be installed and so on. Without the dev option, a failed render also arrives as one of these, with the name Template render error and the message of the Text::Nunjucks::Lib::TemplateError it was made from. Catch it with eval:
eval { $env->render( 'page.njk', {} ); 1 } or do {
my $err = $@;
print $err->name, ': ', $err->message, "\n";
};
message
The error text.
name
The error's name: Error unless given, TypeError for the type errors, RangeError for an invalid array length, URIError for malformed URI input, Template render error for a failed render.
new
Text::Nunjucks::Lib::Error->new('something broke');
Text::Nunjucks::Lib::Error->new( 'wrong type', name => 'TypeError' );
Takes the message and, optionally, name => ...; a single hash reference of attributes works too.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/p5-text-nunjucks/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.