738 Chapter 12: ActionScript Dictionary
Within the RecordSet class’s sortRows() method, one of these previously defined error objects
are thrown depending on the type of exception that occurred. The following code snippet shows
how this code might look.
// Within RecordSet.as class file...
function sortRows() {
...
if(recordSetErrorCondition) {
throw new RecordSetException();
}
if(malFormedRecordCondition) {
throw new MalformedRecord();
}
...
}
Finally, in another AS file or FLA script, the following code invokes the sortRows() method on
an instance of the RecordSet class. It defines
catch blocks for each type of error that is thrown by
sortRows().
try {
myRecordSet.sortRows();
} catch (e:RecordSetException) {
trace("Caught a recordset exception");
} catch (e:MalformedRecord) {
trace("Caught a malformed record exception");
}
See also
Error class, throw, class, extends