
I've been doing some testing to try to figure out the tangled maze that is exception handling. (Is there a *reason* why half of all exceptions are dynamic, and the other half aren't? Couldn't we have just 1 system?) Anyway, I wrote a cute little "test" function for figuring out how each kind of exception works:
test (fail "go away") isAlreadyExistsError=False isDoesNotExistError=False isAlreadyInUseError=False isFullError=False isEOFError=False isIllegalOperation=False isPermissionError=False isUserError=True
Next I tried this:
test (getDirectoryContents "banana") isAlreadyExistsError=False isDoesNotExistError=True isAlreadyInUseError=False isFullError=False isEOFError=False isIllegalOperation=False isPermissionError=False isUserError=False
And now, this:
test (writeFile "C:\\C:\\x" "test") isAlreadyExistsError=False isDoesNotExistError=False isAlreadyInUseError=False isFullError=False isEOFError=False isIllegalOperation=False isPermissionError=False isUserError=False
Erm... so this exception registers as "False" on every single predicate? How exactly am I meant to detect this error?