#1868: Exception fails all exception predicates
----------------------------+-----------------------------------------------
Reporter: Orphi | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.6.1
Severity: normal | Keywords:
Testcase: | Architecture: x86
Os: Windows |
----------------------------+-----------------------------------------------
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?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1868>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs