ifTop (fileServeSingle file) does not work with <|> if the file is missing #5

Closed
intoverflow opened this Issue Jun 20, 2010 · 1 comment

Projects

None yet

2 participants

@intoverflow

If "foo.html" does not exist, the code (ifTop (fileServeSingle "foo.html")) <|> writeBS "some error" will not yield "some error," but rather, will return information about the missing file exception.

@snapframework

Not sure this is an error -- you're supposed to pass "fileServeSingle" a path to a valid file. If you want the mzero behaviour you could try:

((fileServeSingle foo) `catch` (\(e::SomeException) -> mzero)) <|> foo
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment