-
-
Save mc0/1bf764be412d5c956086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------ LANG: EXCEPTION ---------------------------*/ | |
Fuse.addNS('Exception', { | |
'constructor': function(error, info) { | |
if (Fuse.debug) { | |
if (typeof error != 'undefined') | |
Fuse.Exception.console.error(error); | |
if (typeof info != 'undefined') | |
Fuse.Exception.console.info(info); | |
} | |
} | |
}); | |
(function(Exception) { | |
var defaultConsole = { | |
error: function error(error) { throw error }, | |
info: Fuse.emptyFunction | |
}; | |
if (isHostObject(global, 'console') && | |
isHostObject(global.console, 'info') && | |
isHostObject(global.console, 'error')) | |
Exception.console = global.console; | |
else if (isHostObject(global, 'opera') && | |
isHostObject(global.opera, 'postError')) | |
Exception.console = { | |
error: function error(error) { global.opera.postError(error); }, | |
info: function info(info) { global.opera.postError(info); } | |
}; | |
else if (isHostObject(global, 'Jaxer')) { | |
var j = global.Jaxer; | |
if (isHostObject(j, 'Log') && | |
isHostObject(j.Log, 'info') && | |
isHostObject(j.Log, 'error')) | |
Exception.console = { | |
error: function error(error) { j.Log.error("FuseJS: " + +new Date, error) }, | |
info: function info(info) { j.Log.info("FuseJS: " + +new Date, info) } | |
}; | |
else Exception.console = defaultConsole; | |
} | |
else Exception.console = defaultConsole; | |
// prevent JScript bug with named function expressions | |
var error = null, | |
info = null; | |
})(Fuse.Exception); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment