- Aug
- 2,219
- 101
By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!@setlocal
@echo off
type foo.txt 2> nul
if %? eq 2 (
echo File foo.txt does not exist
)
echo type returned error code %?
endlocal
try
type foo.txt
catch 2
echo File does not exist
finally
:: Code to execute whether or not an exception is raised
echo type returned error code %?
end try
I use TCC to test my students' Java programs. I'd love to be able to catch their buggy programs' exceptions and be able to report at least the exception's name (e.g. java.lang.NumberFormatException). I can detect ERRORLEVEL GT 0, but I'd like to report a finer level of detail than "something bad happened."TCC (and Take Command) already do that internally. The only time TCC will crash is when calling a Windows (or third-party) API when that API substitutes its own exception handler and throws a fatal exception on an error.
Or are you asking for a user-configurable exception syntax?