Skip to content

Commit 337c0ab

Browse files
committed
add comments in hapi plugin
1 parent 1c1ec84 commit 337c0ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@ const ErrorHandler = require('./error-handler')
55
async function register (server, options) {
66
const { showErrors = false, template, ...config } = options
77

8+
/**
9+
* Cut early and don’t register extension point,
10+
* e.g. when in production.
11+
*/
812
if (!showErrors) {
913
return
1014
}
1115

16+
/**
17+
* Ensure the user server is able to render
18+
* templates when going for a custom one.
19+
*/
1220
if (template) {
1321
server.dependency(['vision'])
1422
}
1523

24+
/**
25+
* Alright, go for gold!
26+
*/
1627
const errorHandler = new ErrorHandler({ template, ...config })
1728

1829
server.ext('onPreResponse', async (request, h) => {

0 commit comments

Comments
 (0)