mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 21:25:26 +00:00
Removed useless try-catch
This commit is contained in:
20
index.js
20
index.js
@@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user