From 45903f228a103e019f313ec83748d6692c4d0c4e Mon Sep 17 00:00:00 2001 From: Grand Date: Fri, 27 Apr 2018 23:48:51 +0800 Subject: [PATCH] chore: Using "listenerCount" instead of "listeners" (#1184) --- lib/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);