Removed useless try-catch

This commit is contained in:
alexandercerutti
2018-08-28 15:39:43 +02:00
parent cdc23ecc22
commit 6502ba2e24

View File

@@ -430,21 +430,17 @@ class Pass {
_validateType(passBuffer) { _validateType(passBuffer) {
let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"]; let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"];
try { let passFile = JSON.parse(passBuffer.toString("utf8"));
let passFile = JSON.parse(passBuffer.toString("utf8")); let index = passTypes.findIndex(passType => passFile.hasOwnProperty(passType));
let index = passTypes.findIndex(passType => passFile.hasOwnProperty(passType));
if (index == -1) { if (index == -1) {
return false;
}
let type = passTypes[index];
this.type = type;
return schema.isValid(passFile[type], "passDict");
} catch (e) {
return false; return false;
} }
let type = passTypes[index];
this.type = type;
return schema.isValid(passFile[type], "passDict");
} }
/** /**