Multiple throw statements and multiple catch statements
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var sUsername:String = "";
var erToThrow:Error;
try {
if(sUsername == "") {
throw new EmptyStringException();
}
if(sUsername == undefined) {
throw new UndefinedException();
}
}
catch (erObject:EmptyStringException) {
// Code to handle error.
}
catch (erObject:UndefinedException) {
// Code to handle error.
}
}
}
}
Related examples in the same category