Permalink
Browse files

Improves error handling when rendering components to string

  • Loading branch information...
zenorocha committed Feb 22, 2018
1 parent caa524d commit cf9ee144bf88a0829b4d4dfd3a21d9d7603abb0a
Showing with 13 additions and 5 deletions.
  1. +13 −5 packages/electric/lib/tasks/metal.js
@@ -6,6 +6,7 @@ const compileSoy = require('metal-tools-soy/lib/pipelines/compileSoy');
const data = require('gulp-data');
const filter = require('gulp-filter');
const frontMatter = require('gulp-front-matter');
const gutil = require('gulp-util');
const fs = require('fs-extra');
const globby = require('globby');
const path = require('path');
@@ -268,11 +269,18 @@ module.exports = function(options) {
data.page.componentName = component.default.name;
}
const componentString = Component.renderToString(
component.default, {
page: data.page,
pageLocation: data.pageLocation,
site: data.site
try {
const componentString = Component.renderToString(
component.default, {
page: data.page,
pageLocation: data.pageLocation,
site: data.site
}
);
}
catch(e) {
gutil.log(`Error when trying to render the "${file.path}" file`);
}
}
);

0 comments on commit cf9ee14

Please sign in to comment.