Questions about passport-local-mongoose Custom Errors

  node.js, question

Recently, I did some hands-on exercises for Node, and then I planned to do a user authentication. I saw some data recommending passport-local-mongoose. I tried to do a Demo and could run. I originally planned to customize the error according to the method given in the document, but found no way. My code is as follows

var options = {
 UserExistsError:' user name already exists!'
 };
 
 Account.plugin(passportLocalMongoose,options);
 
 module.exports = mongoose.model('Account', Account);

But in reality

clipboard.png
The error report is still as shown in the above figure. I don’t know if anyone uses passport-local-mongoose plug-in to guide where the error is.

I have already solved the problem. I have searched the source code and found that there are some problems with the existing tutorials on the network. It should be

var options = {errorMessages:
 {UserExistsError:' user name already exists!'  bracket
 };