selfdefined/node_modules/@11ty/eleventy/src/EleventyErrorUtil.js

18 lines
590 B
JavaScript
Raw Normal View History

2019-11-26 14:50:43 -08:00
const TemplateContentPrematureUseError = require("./Errors/TemplateContentPrematureUseError");
class EleventyErrorUtil {
static isPrematureTemplateContentError(e) {
// TODO the rest of the template engines
return (
e instanceof TemplateContentPrematureUseError ||
(e.originalError &&
e.originalError.name === "RenderError" &&
e.originalError.originalError instanceof
TemplateContentPrematureUseError) || // Liquid
e.message.indexOf("TemplateContentPrematureUseError") > -1
); // Nunjucks
}
}
module.exports = EleventyErrorUtil;