gscan
gscan copied to clipboard
Better error handling for compile errors
When running into an Handlebars error, GScan doesn't really tell you what went wrong.
GScan renders an error like that:
Uh-Oh, There was an error.
Cannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined at /opt/gscan/releases/2018-09-06T12:20:32.572Z/lib/format.js:60:38 at /opt/gscan/shared/node_modules/lodash/lodash.js:4925:15 at baseForOwn (/opt/gscan/shared/node_modules/lodash/lodash.js:3010:24) at /opt/gscan/shared/node_modules/lodash/lodash.js:4894:18 at Function.forEach (/opt/gscan/shared/node_modules/lodash/lodash.js:9342:14) at Object.format (/opt/gscan/releases/2018-09-06T12:20:32.572Z/lib/format.js:52:7) at doRender (/opt/gscan/releases/2018-09-06T12:20:32.572Z/app/index.js:80:30) at Layer.handle [as handle_request] (/opt/gscan/shared/node_modules/express/lib/router/layer.js:95:5) at next (/opt/gscan/shared/node_modules/express/lib/router/route.js:137:13) at /opt/gscan/releases/2018-09-06T12:20:32.572Z/app/index.js:68:32 at PassThroughHandlerContext.finallyHandler (/opt/gscan/shared/node_modules/bluebird/js/release/finally.js:56:23) at PassThroughHandlerContext.tryCatcher (/opt/gscan/shared/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/opt/gscan/shared/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/opt/gscan/shared/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/opt/gscan/shared/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/opt/gscan/shared/node_modules/bluebird/js/release/promise.js:693:18)

Which was - in this case - caused by opening with {{primary_author}}, but closing with {{/author}}. This should be detected and better communicated.