function theResult = throw(theThrownObject) % throw -- Throw an exception. % throw(theThrownObject) throws an exception, % which is expected to be handled by a try/catch % block somewhere in the chain of callers. The % thrown-object, which can be anything, is stored % for later retrieval by the exception handler. % throw (no argument) retrieves the thrown-object, % then clears itself. If the handler cannot deal % with the exception, it should re-throw it. % Copyright (C) 1998 Dr. Charles R. Denham, ZYDECO. % All Rights Reserved. % Disclosure without explicit written consent from the % copyright owner does not constitute publication. % Version of 18-Aug-1998 09:29:02. persistent THROWN_OBJECT if nargin < 1 & nargout < 1 help(mfilename) return end if nargin > 0 THROWN_OBJECT = theThrownObject; error(' ## No Exception Handler Available.') end if nargout > 0 theResult = THROWN_OBJECT; end