diff --git a/lib/application.js b/lib/application.js index 5e09e8a..a9b76fb 100644 --- a/lib/application.js +++ b/lib/application.js @@ -125,7 +125,7 @@ module.exports = class Application extends Emitter { callback() { const fn = compose(this.middleware); - if (!this.listeners('error').length) this.on('error', this.onerror); + if (!this.listenerCount('error')) this.on('error', this.onerror); const handleRequest = (req, res) => { const ctx = this.createContext(req, res);