//Single LIne Try Catch Block. Catches errors such as use of undefined functions or methods, or attempting to reference fields of a null object. try { RunServerSideCustomCode(); } catch(err){ var s = "Error caught by catch block: " + err.toString(); gs.error(s); gs.addErrorMessage(s); } function RunServerSideCustomCode(){ //Write custom code here... null.MyInvalidFunctionCall(); }