mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-15 13:18:27 +00:00
formatting server error
This commit is contained in:
parent
21eda65cb4
commit
1113b5d117
@ -55,10 +55,7 @@ export default class Listener {
|
|||||||
this._server = protocol.createServer.apply(protocol, protocolOpts.concat(this.app))
|
this._server = protocol.createServer.apply(protocol, protocolOpts.concat(this.app))
|
||||||
|
|
||||||
// Listen server error
|
// Listen server error
|
||||||
/* istanbul ignore next */
|
this._server.on('error', this.errorHandler)
|
||||||
this._server.on('error', (e) => {
|
|
||||||
consola.error(e)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Prepare listenArgs
|
// Prepare listenArgs
|
||||||
const listenArgs = this.socket ? { path: this.socket } : { host: this.host, port: this.port }
|
const listenArgs = this.socket ? { path: this.socket } : { host: this.host, port: this.port }
|
||||||
@ -78,4 +75,14 @@ export default class Listener {
|
|||||||
// Set this.listening to true
|
// Set this.listening to true
|
||||||
this.listening = true
|
this.listening = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errorHandler(e) {
|
||||||
|
const errors = {
|
||||||
|
EACCES: 'Permission denied. Does your user have permission?',
|
||||||
|
EADDRINUSE: `Address \`${this.host}:${this.port}\` is already in use. Do you run another service on the same port?`,
|
||||||
|
EDQUOT: 'Disk quota exceeded. Do you have space in disk?'
|
||||||
|
};
|
||||||
|
|
||||||
|
consola.error(errors[e.code] || e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user