[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit ScriptException.java,NONE,1.1 HttpUnitOpt
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-09-13 18:35:02
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv23375/src/com/meterware/httpunit Modified Files: HttpUnitOptions.java Added Files: ScriptException.java Log Message: Added control of script error messages ***** Error reading new file[Errno 2] No such file or directory: 'ScriptException.java' Index: HttpUnitOptions.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- HttpUnitOptions.java 30 Aug 2002 15:20:09 -0000 1.26 +++ HttpUnitOptions.java 13 Sep 2002 18:34:57 -0000 1.27 @@ -406,6 +406,40 @@ } + + /** + * Determines whether script errors result in exceptions or warning messages. + */ + public static void setExceptionsThrownOnScriptError( boolean throwExceptions ) { + getScriptingEngine().setThrowExceptionsOnError( throwExceptions ); + } + + + /** + * Returns true if script errors cause exceptions to be thrown. + */ + public static boolean getExceptionsThrownOnScriptError() { + return getScriptingEngine().isThrowExceptionsOnError(); + } + + + /** + * Returns the accumulated script error messages encountered. Error messages are accumulated only + * if 'throwExceptionsOnError' is disabled. + */ + public static String[] getScriptErrorMessages() { + return getScriptingEngine().getErrorMessages(); + } + + + /** + * Clears the accumulated script error messages. + */ + public static void clearScriptErrorMessages() { + getScriptingEngine().clearErrorMessages(); + } + + private static void disableScripting( Exception e, String errorMessage ) { System.err.println( errorMessage + _scriptEngineClassName ); System.err.println( "" + e ); @@ -421,8 +455,11 @@ private static final ScriptingEngineFactory NULL_SCRIPTING_ENGINE_FACTORY = new ScriptingEngineFactory() { public boolean isEnabled() { return false; } - public void associate( WebResponse response ) { - } + public void associate( WebResponse response ) {} + public void setThrowExceptionsOnError( boolean throwExceptions ) {} + public boolean isThrowExceptionsOnError() { return false; } + public String[] getErrorMessages() { return new String[ 0 ]; } + public void clearErrorMessages() {} }; |