Move catch into then-onRejected to fix resolving then anyways.
This commit is contained in:
parent
b0bbf0c71a
commit
2356040572
@ -40,12 +40,7 @@ function checkWriteApi(influxDb, options){
|
|||||||
const writeApi = influxDb.getWriteApi(options.org, options.bucket); // Get WriteAPI
|
const writeApi = influxDb.getWriteApi(options.org, options.bucket); // Get WriteAPI
|
||||||
writeApi.writePoint(new Point("test").tag("ConnectionTest", true).intField("value", 0).timestamp(0)) // Write dummy-point
|
writeApi.writePoint(new Point("test").tag("ConnectionTest", true).intField("value", 0).timestamp(0)) // Write dummy-point
|
||||||
writeApi.close()
|
writeApi.close()
|
||||||
.catch((err) => {
|
.then((res) => {
|
||||||
logger.error("Could not get writeApi:");
|
|
||||||
logger.error(`Error [${err.code}]:`, err.message);
|
|
||||||
if(err.code == "not found") logger.error("No write-permission?");
|
|
||||||
reject();
|
|
||||||
}).then((res) => {
|
|
||||||
logger.debug("Writing ok");
|
logger.debug("Writing ok");
|
||||||
|
|
||||||
// Delete the connection-text-point
|
// Delete the connection-text-point
|
||||||
@ -64,6 +59,11 @@ function checkWriteApi(influxDb, options){
|
|||||||
reject();
|
reject();
|
||||||
})
|
})
|
||||||
.then(resolve())
|
.then(resolve())
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
logger.error("Could not get writeApi:");
|
||||||
|
logger.error(`Error [${err.code}]:`, err.message);
|
||||||
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user