Skip to content

Commit

Permalink
hook: Handle hook error and continue process
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Oct 30, 2017
1 parent ad59f78 commit daaa5bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/core/nuxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ export default class Nuxt {
if (!this._hooks[name]) {
return
}
await sequence(this._hooks[name], (fn) => fn(...args))
debug(`Call ${name} hooks (${this._hooks[name].length})`)
try {
await sequence(this._hooks[name], (fn) => fn(...args))
} catch (err) {
console.error(`> Error on hook "${name}":`) // eslint-disable-line no-console
console.error(err) // eslint-disable-line no-console
}
}

listen(port = 3000, host = 'localhost') {
Expand Down

0 comments on commit daaa5bd

Please sign in to comment.