diff options
Diffstat (limited to 'js/src/Ice/ExUtil.js')
-rw-r--r-- | js/src/Ice/ExUtil.js | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/js/src/Ice/ExUtil.js b/js/src/Ice/ExUtil.js index c2fc0f0669d..b9c89f0d959 100644 --- a/js/src/Ice/ExUtil.js +++ b/js/src/Ice/ExUtil.js @@ -7,23 +7,21 @@ // // ********************************************************************** -(function(global){ - // - // Exception utilities - // - - require("Ice/LocalException"); - - var Ice = global.Ice || {}; - - // - // Local aliases. - // - var UnexpectedObjectException = Ice.UnexpectedObjectException; - var MemoryLimitException = Ice.MemoryLimitException; - var ExUtil = {}; +var Ice = require("../Ice/LocalException").Ice; - ExUtil.toString = function(ex) +// +// Local aliases. +// +var UnexpectedObjectException = Ice.UnexpectedObjectException; +var MemoryLimitException = Ice.MemoryLimitException; + +// +// Exception utilities +// + +Ice.ExUtil = +{ + toString: function(ex) { if(!ex.stack) { @@ -33,21 +31,17 @@ { return ex.stack; } - }; - - ExUtil.throwUOE = function(expectedType, v) + }, + throwUOE: function(expectedType, v) { var type = v.ice_id(); throw new UnexpectedObjectException("expected element of type `" + expectedType + "' but received '" + type, type, expectedType); - }; - - ExUtil.throwMemoryLimitException = function(requested, maximum) + }, + throwMemoryLimitException: function(requested, maximum) { throw new MemoryLimitException("requested " + requested + " bytes, maximum allowed is " + maximum + - " bytes (see Ice.MessageSizeMax)"); - }; - - Ice.ExUtil = ExUtil; - global.Ice = Ice; -}(typeof (global) === "undefined" ? window : global)); + " bytes (see Ice.MessageSizeMax)"); + } +}; +module.exports.Ice = Ice; |