Attempt to quit with an error code when an assertion fails.

This only works in the standalone debug player, if the swf is a trusted
local file.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4925 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-01-24 18:09:49 +00:00
parent 24f557c0d7
commit cd421f7fa7
+9
View File
@@ -22,6 +22,7 @@
package com.threerings.util {
import flash.system.Capabilities;
import flash.system.System;
/**
* Simple implementation of assertion checks for debug environments.
@@ -81,6 +82,14 @@ public class Assert
if (dumpStack) {
_log.warning(new Error("dumpStack").getStackTrace());
}
// try to exit, but don't booch if we're running in an older player
var o :Object = System;
try {
o["exit"](1); // call System.exit(1);
} catch (err :SecurityError) {
// probably not allowed
}
}
protected static var _log :Log = Log.getLog(Assert);