Changed schema violation from throw to Promise rejection

This commit is contained in:
alexandercerutti
2018-07-24 00:57:21 +02:00
parent 903d854723
commit 2d66e14f15

View File

@@ -394,10 +394,16 @@ class Pass {
*/ */
_parseSettings(options) { _parseSettings(options) {
return new Promise((success, reject) => {
if (!schema.isValid(options, schema.constants.instance)) { if (!schema.isValid(options, schema.constants.instance)) {
throw new Error("The options passed to Pass constructor does not meet the requirements. Refer to the documentation to compile them correctly."); return Promise.reject({
status: false,
error: {
message: "The options passed to Pass constructor does not meet the requirements. Refer to the documentation to compile them correctly."
} }
});
}
return new Promise((success, reject) => {
if (!options.model || typeof options.model !== "string") { if (!options.model || typeof options.model !== "string") {
return reject({ return reject({