Exception |
Used for reporting fatal errors that occur in an application. Fatal errors are errors that are serious enough to stop further execution of the current method lineage (callers, their parent callers, etc.) Unlike error broadcasts, which are non fatal, exceptions are thrown and typicaly report their state in a popup dialog box generated by the runtime. It is recommended to use the included commit method to throw the exception rather than throwing the Exception instance directly. This ensures that the error information is properly formatted and included with the Error object which is used for the runtime error dialog.
__/ REQUIREMENTS \__
ActionScript 3.0 (or later)
__/ IMPORTS \__
nothing
__/ EXTENDS \__
com.bnm.api.CoreData com.bnm.api.instances.Exception flash.utils.* flash.errors.*
__/ IMPLEMENTS \__
nothing
__/ NOTICE \__
©opyright 2008 Bay New Media. All rights, as stipulated in the The MIT License, are reserved.
This ActionScript library is licensed and released under the MIT License (http://www.opensource.org
Please visit http://www.baynewmedia.com/ or email con@baynewm edia.com for information, questions, concerns, or bug reports. tact
__/ NOTES \__
This class is commented using the NaturalDocs documentation system. It is intended to be easily read both from the direct source code and from an adaptation that is generated as hyperlinked HTML. The NaturalDocs specification used in this class’ documentation is version 1.35 though older versions may probably be used safely. For more information, please visit: http://www.naturaldocs.org/
The BNMAPI is officially available (primary sources) on Source Forge (http://sourceforge.net/projects/bnmapi/), on the Bay New Media site (http;//www.baynewmedia.com/), on the PeaBee project site (http://www.peabee.com/), and through the Bay New Media SVM repository server (visit http://www.baynewmedia.com/ for more information). Downloads from other sources may not be complete or up-to-date.
If you’re interested in joining the BNMAPI project in any capacity (development, testing, distribution, etc.), please visit us on Source Forge or the Bay New Media web site.
Exception | Used for reporting fatal errors that occur in an application. |
Variables | |
message | (String) A string describing the fatal condition. |
remedy | (String) A string describing a possible solution to the problem. |
code | (int) An error code to include with the exception. |
_sourceMethodName | (String) The name of the source method (the method throwing the exception). |
_sourceObjectID | (String) The name of the source object (the object throwing the exception). |
_fullSourceObjectPath | (String) The full package path (including class name) of the specified source object (the object throwing the exception). |
Functions | |
Exception | Creates a new Exception instance. |
commit | Commits the exception by throwing an Error object. |
getSourceMethodName | Returns the method name if the specified method within the specified object. |
getSourceObjectID | Returns the short class ID (not full class path) of the specified parameter object. |
getSourcePath | Returns the full class package path of the specified parameter object. |
public var remedy: String
(String) A string describing a possible solution to the problem. Try to include specific information that can be acted on, as well as information on finding specific locations in source code, data, etc., that isn’t covered by the general object detection in the constructor.
public function Exception ( sourceObject: *, sourceMethod: Function, ... args )
Creates a new Exception instance.
sourceObject (untyped, required): The object that is generating the fatal error. The object will be scanned to provide extra information for the error report. sourceMethod (function, required): The source method generating the error. This method must reside in the sourceObject parameter otherwise it can’t be identified.This is appended to the full object path when reporting the error. message (string, optional): The error message to be displayed in the runtime error dialog that will describe the reason for the exception throw. remedy (string, optional): A suggested remedy to the problem. This is a brief description of common fixes that may be attempted by the developer and/or end-user (depending on the type of reporting mechanism chosen). If the remedy isn’t provided, it should be set before calling the commit method. The remedy is optional (though recommended), so the error can still be thrown even if the remedy isn’t provided. code (int, optional): An error code to include with the broadcast or with the Flash runtime error dialog. This value is arbitrary (within the bounds of the ‘int’ data type), but it is advisable to create a standardized code system for clarity.
Exception: A reference to the newly created class instance.
nothing
nothing
no
public function commit()
Commits the exception by throwing an Error object. The supplied error information is formatted so that it appears correctly within the runtime dialog. Ensure that variables such as message and remedy are set before throwing the exception otherwise no information will be provided to the developer/user. It is highly recommended to use this method instead of throwing the Exception instance directly since this is likely to produce unexpected results.
none
nothing
nothing
Error
private function getSourceMethodName( objectRef: *, methodRef: Function ):String
Returns the method name if the specified method within the specified object.
objectRef (untyped, required): Any object to evaluate. methodRef (Function, required): A reference to the method for which to find the name. This method must reside within the ‘objectRef’ object.
String: The method name of the specified method reference provided. If the method can’t be found in the specified source object, NULL is returned.
nothing
nothing
no
private function getSourceObjectID( objectRef: * ):String
Returns the short class ID (not full class path) of the specified parameter object.
objectRef (untyped, required): Any object to evaluate for a class name.
String: The short class name of the parameter object. Returns NULL if the parameter was NULL or otherwise invalid.
nothing
nothing
no
private function getSourcePath( objectRef: * ):String
Returns the full class package path of the specified parameter object.
objectRef (untyped, required): Any object to evaluate for a path.
String: The fully qualified class path (including class name) of the parameter object. Returns NULL if the parameter was NULL or otherwise invalid.
nothing
nothing
no
(String) A string describing the fatal condition.
public var message: String
(String) A string describing a possible solution to the problem.
public var remedy: String
(int) An error code to include with the exception.
public var code: int
(String) The name of the source method (the method throwing the exception).
private var _sourceMethodName: String
(String) The name of the source object (the object throwing the exception).
private var _sourceObjectID: String
(String) The full package path (including class name) of the specified source object (the object throwing the exception).
private var _fullSourceObjectPath: String
Creates a new Exception instance.
public function Exception ( sourceObject: *, sourceMethod: Function, ... args )
Commits the exception by throwing an Error object.
public function commit()
Returns the method name if the specified method within the specified object.
private function getSourceMethodName( objectRef: *, methodRef: Function ):String
Returns the short class ID (not full class path) of the specified parameter object.
private function getSourceObjectID( objectRef: * ):String
Returns the full class package path of the specified parameter object.
private function getSourcePath( objectRef: * ):String