Exception fails all exception predicates
Attempting to operate on a file with an invalid filename (e.g., "C:\C:\") yields an "invalid parameter" exception. This exception appears to be a kind of IOError
, yet it fails all 8 exception predicates.
test :: IO x -> IO ()
test a = do
catch (a >> return ()) examine
examine :: IOError -> IO ()
examine ioe = do
putStrLn $ "isAlreadyExistsError___" ++ show (isAlreadyExistsError ioe)
putStrLn $ "isDoesNotExistError " ++ show (isDoesNotExistError ioe)
putStrLn $ "isAlreadyInUseError____" ++ show (isAlreadyInUseError ioe)
putStrLn $ "isFullError " ++ show (isFullError ioe)
putStrLn $ "isEOFError_____________" ++ show (isEOFError ioe)
putStrLn $ "isIllegalOperation " ++ show (isIllegalOperation ioe)
putStrLn $ "isPermissionError______" ++ show (isPermissionError ioe)
putStrLn $ "isUserError " ++ show (isUserError ioe)
Now try, for example, test (openFile "C:\\C:\\" ReadMode)
. All 8 predicates above return False. (However, if you do, say, test (error "no")
, the catch
function doesn't trap it at all because it's not an IOError
.)
I was under the impression this is what the "illegal operation" type was for?
Trac metadata
Trac field | Value |
---|---|
Version | 6.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |