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:
@@ -22,6 +22,7 @@
|
|||||||
package com.threerings.util {
|
package com.threerings.util {
|
||||||
|
|
||||||
import flash.system.Capabilities;
|
import flash.system.Capabilities;
|
||||||
|
import flash.system.System;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple implementation of assertion checks for debug environments.
|
* Simple implementation of assertion checks for debug environments.
|
||||||
@@ -81,6 +82,14 @@ public class Assert
|
|||||||
if (dumpStack) {
|
if (dumpStack) {
|
||||||
_log.warning(new Error("dumpStack").getStackTrace());
|
_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);
|
protected static var _log :Log = Log.getLog(Assert);
|
||||||
|
|||||||
Reference in New Issue
Block a user