From 2aa39dc81c27fe01a8aa5ac967f68f6de421d0dd Mon Sep 17 00:00:00 2001 From: Johan Lindell Date: Wed, 21 Dec 2016 16:00:50 +0100 Subject: [PATCH] Made init function have error handling Fixing #118 --- src/JsBarcode.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/JsBarcode.js b/src/JsBarcode.js index 77427365..678e1f19 100644 --- a/src/JsBarcode.js +++ b/src/JsBarcode.js @@ -150,13 +150,13 @@ API.prototype.init = function(){ options.format = autoSelectBarcode(); } - var text = options.value; + this._errorHandler.wrapBarcodeCall(function(){ + var text = options.value; + var Encoder = barcodes[options.format.toUpperCase()]; + var encoded = encode(text, Encoder, options); - var Encoder = barcodes[options.format.toUpperCase()]; - - var encoded = encode(text, Encoder, options); - - render(renderProperty, encoded, options); + render(renderProperty, encoded, options); + }); } };