mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-12 03:38:07 +00:00
hook: Handle hook error and continue process
This commit is contained in:
parent
ad59f788dc
commit
daaa5bdd12
@ -64,7 +64,13 @@ export default class Nuxt {
|
|||||||
if (!this._hooks[name]) {
|
if (!this._hooks[name]) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
debug(`Call ${name} hooks (${this._hooks[name].length})`)
|
||||||
|
try {
|
||||||
await sequence(this._hooks[name], (fn) => fn(...args))
|
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') {
|
listen(port = 3000, host = 'localhost') {
|
||||||
|
Loading…
Reference in New Issue
Block a user