DB.insertOne(something).then( (r) =>
{
done({success:true});
}).catch( (e) =>
{
done({success:false, message:e.code});
});
My question - is it possible to delete the catch block, once the insert command has successfully completed? I want to do this because I do not want the mongodb .catch() block executing when irrelevant and unrelated events crash occur down the line. I am looking for something like this.
DB.insertOne(something).then( (r) =>
{
delete this.catch;//does not work
done({success:true});
}).catch( (e) =>
{
done({success:false, message:e.code});
});
note also that I do need the catch block in general. I need the catch block to execute once - for example if the insert command were to return an error for attempting to insert the same document with the same ._id (for example).
0 comments:
Post a Comment
Thanks