From cbc190c5d38424a05506ba01e24ad94524589337 Mon Sep 17 00:00:00 2001 From: Igor Lopes Date: Wed, 24 May 2017 09:55:36 -0300 Subject: [PATCH] Add error code and array of duplicates in beautified error --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index e4bbbb5..24bd670 100644 --- a/index.js +++ b/index.js @@ -99,6 +99,8 @@ function beautify(error, doc, messages) { var beautifiedError = new MongooseError.ValidationError(); beautifiedError.errors = suberrors; + beautifiedError.code = error.code; + beautifiedError.fields = Object.keys(suberrors); return beautifiedError; }); }