00001 #include <cppscript> 00002 00003 var compute() 00004 { 00005 throw exception("compute_failure", "Not implemented"); 00006 } 00007 00008 var script_main(var) 00009 { 00010 try 00011 { 00012 compute(); 00013 } 00014 catch(var ex) 00015 { 00016 if( ex.class_name() == "compute_failure" ) 00017 writeln("The computation failed because " + ex["text"]); 00018 else 00019 throw; // Re-throws the exception - caught in main() 00020 } 00021 return 0; 00022 } 00023
1.5.7.1