
Untitled
By: a guest on
May 10th, 2012 | syntax:
None | size: 0.79 KB | hits: 16 | expires: Never
/*
* Copyright 2002-2011 by Wingspan Technology, Inc.,
* All rights reserved.
*/
wspt.formatString = function(sFmt /*...*/)
{
var sFmt = '' + sFmt; // support wspt.info(oObj); (no format string)
var sMsg = String.format.apply(null, arguments);
return sMsg;
};
wspt.info = function(sFmt /*...*/)
{
var sMsg = wspt.formatString.apply(null, arguments);
wspt.getLog().info(sMsg);
wspt.alertInfo(sMsg);
};
wspt.assert = function(bTestVal, sFmt /*...*/)
{
if(!bTestVal)
{
var args = Array.prototype.slice.call(arguments);
args.shift();
var sMsg = wspt.formatString.apply(null, args);
// fail loudly in case the exception gets swallowed
wspt.getLog().error(sMsg);
wspt.alertError(sMsg);
throw Error(sMsg);
}
};