From 6502ba2e24bc5e303b7159c85d22de60c7ff4cbd Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Tue, 28 Aug 2018 15:39:43 +0200 Subject: [PATCH] Removed useless try-catch --- index.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index babc574..7f7387d 100644 --- a/index.js +++ b/index.js @@ -430,21 +430,17 @@ class Pass { _validateType(passBuffer) { let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"]; - try { - let passFile = JSON.parse(passBuffer.toString("utf8")); - let index = passTypes.findIndex(passType => passFile.hasOwnProperty(passType)); + let passFile = JSON.parse(passBuffer.toString("utf8")); + let index = passTypes.findIndex(passType => passFile.hasOwnProperty(passType)); - if (index == -1) { - return false; - } - - let type = passTypes[index]; - - this.type = type; - return schema.isValid(passFile[type], "passDict"); - } catch (e) { + if (index == -1) { return false; } + + let type = passTypes[index]; + + this.type = type; + return schema.isValid(passFile[type], "passDict"); } /**