In the document-editor.js module, the upsertDocument.call destructures the second parameter. The second parameter will be undefined on an error and throw a TypeError rather than allowing the error parameter to be passed to the function and handled by Bert. I have changed the second parameter to a regular variable and refer to insertedId later using response.insertedId.
This can be tested by changing the required type in the schema file and then passing in the wrong type through the form.
In the
document-editor.js
module, theupsertDocument.call
destructures the second parameter. The second parameter will be undefined on an error and throw a TypeError rather than allowing the error parameter to be passed to the function and handled by Bert. I have changed the second parameter to a regular variable and refer toinsertedId
later usingresponse.insertedId
. This can be tested by changing the required type in the schema file and then passing in the wrong type through the form.