[Haskell-cafe] An exceptional exception
Andrew Coppin
andrewcoppin at btinternet.com
Thu Nov 8 17:22:40 EST 2007
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?
More information about the Haskell-Cafe
mailing list