mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 22:25:24 +00:00
Changed schema violation from throw to Promise rejection
This commit is contained in:
12
index.js
12
index.js
@@ -394,10 +394,16 @@ class Pass {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
_parseSettings(options) {
|
_parseSettings(options) {
|
||||||
|
if (!schema.isValid(options, schema.constants.instance)) {
|
||||||
|
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) => {
|
return new Promise((success, reject) => {
|
||||||
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.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.model || typeof options.model !== "string") {
|
if (!options.model || typeof options.model !== "string") {
|
||||||
return reject({
|
return reject({
|
||||||
|
|||||||
Reference in New Issue
Block a user