node-ottoman
node-ottoman copied to clipboard
DocumentNotFound Exception
In the 04/13 meeting with the customer it was determined that the following mutation operations are not throwing back DocumentNotFound Exception
findOneAndUpdate
removeById
replaceById
updateById
findOne
Can someone please verify to see what could be the reason ? If its Nodejs SDK not throwing back the exception we will need to know ASAP.
@AV25242 in the file couchnode\lib\errors.js of the sdk adding this change in the method of line 16:
class CouchbaseError extends Error {
constructor(errtext, baseerr, context, ...args) {
super(errtext, ...args);
this.cause = baseerr;
this.context = context;
this.name = this.constructor.name; // 👈👈👈 adding this line the errors comes out with the corresponding name
Error.captureStackTrace(this, CouchbaseError);
}
}
exports.CouchbaseError = CouchbaseError;
The errors would be showing with their corresponding names, example:
const CatSchema = new Schema({
name: String,
age: Number,
});
const Cat = model('Cat', CatSchema);
try {
await Cat.updateById('id-no-found', {})
} catch (e) {
const { name, message } = e;
console.log(`Name: ${JSON.stringify(name)}`);
console.log(`Message: ${JSON.stringify(message)}`);
}
// OUTPUT with update
Name: "DocumentNotFoundError"
Message: "document not found"
// OUTPUT without update
Name: "Error"
Message: "document not found" (editado)
@gsi-ariam thanks much, I have reported this information in the Nodejs ticket and made @brett19 aware of this, he will evaluate it.
related to #356
@gsi-alejandro and @gsi-ariam the underlying SDK issue https://issues.couchbase.com/browse/JSCBC-855 seems to be getting released today with SDK 3.2 Beta please do the necessary changes on Ottoman side
@AV25242 according to Brett: "SDK currently only supports our internal builds."
I even tried uploading the couchbase version to 3.1.3 and it doesn't work either it gives the same error as the 3.2-beta version:
Error: LCB_ERR_KVENGINE_INVALID_PACKET (1031): A badly formatted packet was sent to the server. Please report this in a bug