hapijs / hapijs/vision

error in helper not shown

Open
#220 0 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
198
Forks
68
PR merge metrics
No merged PRs in 30d

Description

#### Support plan
community plan, no claims

* *is this issue currently blocking your project?* (yes/no):no
* *is this issue affecting a production system?* (yes/no):no

#### Context

* *node version*: 16.15.1
* *module version with issue*:@hapi/vision 6.1.0
* *last module version without issue*: don't know
* *environment* (e.g. node, browser, native): node
* *used with* (e.g. hapi application, another framework, standalone, ...):hapi app
* *any other relevant information*:the issue has already been reported at: https://github.com/outmoded/discuss/issues/164

#### What are you trying to achieve or the steps to reproduce?
i had a syntax error in a file required in a handlebar helper file (js).
the server gave an error on server load, but did not show the error itself.
i found the place the error should be passed to hapi log, but it dissapeared somehow:
node_modules/@hapi/vision/lib/manager.js,
at the error catch of _loadHelpers(engine).
my workaround was to build an object of the error fields and pass it instead:
err = {message: err.message,stack: err.stack};
i'm sure you can do it better and make it look nicer, but feel free to make any use of it.

```js
catch (err) {
this._server.log(['vision', 'helper', 'load', 'error'], { file, err });
}
```

#### What was the result you got?
Debug: vision, helper, load, error
{"file":"/mnt/chromeos/MyFiles/nodejs-proj/paldo-ridles/lib/templates/helpers/form_field.js","_err":{}}
#### What result did you expect?
i expected the error to be displayed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.