diff --git a/app.js b/app.js index c95b39b..e8c9c01 100644 --- a/app.js +++ b/app.js @@ -188,7 +188,7 @@ if (typeof CreateObject === "undefined") { } if (typeof UseObject === "undefined") { - var UseObject = function(progId, callback, dispose) { + var UseObject = function(progId, callback, dispose, fallback) { if (typeof callback !== "function") { return null; } @@ -204,6 +204,9 @@ if (typeof UseObject === "undefined") { var obj = CreateObject(progId); try { return callback(obj); + } catch (e) { + return (typeof fallback === "function" ? + fallback(obj, e) : null); } finally { dispose(obj); obj = null;