From d7a9530b68e924a26a7f55bf9bed54ea4260a2e7 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Fri, 26 Nov 2021 17:31:31 +0100 Subject: [PATCH] Cleaned up Promise --- src/streamHandler/InfluxPointWriter.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/streamHandler/InfluxPointWriter.js b/src/streamHandler/InfluxPointWriter.js index 02b0a27..9a57136 100644 --- a/src/streamHandler/InfluxPointWriter.js +++ b/src/streamHandler/InfluxPointWriter.js @@ -25,10 +25,8 @@ class InfluxPointWriter extends Writable{ _flush(next){ this._api.flush(true) - .then( - next, - (err) => { next(new Error(`WriteApi rejected promise for flush: ${err}`)); } - ); + .catch((err) => { next(new Error(`WriteApi rejected promise for flush: ${err}`)); }) + .then(next); } }