How to ignore exception or Error and continue IO actions in Haskell?

McBear Holden
main :: IO ()
main = do
    res <- try (mapM_ (callProcess "pandoc") [["--help"],["-eoc"],["-exois"],["--help"]]) :: IO (Either SomeException ())
    case res of
        Right a -> print "done"
        Left e -> print "error"

in the above code, some of the argument for the command pandoc are wrong and pandoc will throw errors. but I want my code to continue without stopping there and finish the mapM_

What Exception handling should I use?

The error I have is:

    pandoc: unrecognized option `-e'
Try pandoc --help for more information.
"error"
Daniel Wagner

Instead of trying your best to do a whole block of commands, have a block of commands that each try their best. Change try (mapM_ foo bar) into mapM_ (try . foo) bar.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to ignore an exception and continue processing a foreach loop?

From Dev

How to ignore exception in a loop and continue the excution

From Dev

Exception Error in Java : How to continue?

From Dev

Java Ignore Exception and Continue

From Dev

Ignore Exception in Observable and Continue

From Dev

How to force ignore/continue past a 1004 error?

From Dev

How to ignore error and continue infinite stream?

From Dev

How to force ignore/continue past a 1004 error?

From Dev

Mapping with IO actions in Haskell

From Dev

How to handle this simple IO exception in Haskell

From Dev

How to handle this simple IO exception in Haskell

From Dev

Infinite loop - ignore error and continue?

From Dev

ignore exception and continue & counting files in a directory

From Dev

Hspec deal with two IO actions in Haskell

From Dev

Java exception error during RJDBC::dbConnect: how to silently ignore?

From Dev

How to ignore exception

From Dev

IO Exception was unhandled error

From Dev

How to do multiple actions in Haskell

From Dev

How to continue after an exception? Python

From Dev

Ignore and continue on specific Symfony2 kernel.exception event

From Dev

Nlog Error(message, exception) ignore exception

From Dev

How to ignore invalid arguments with getopts and continue parsing?

From Dev

Haskell: exception handling in non-IO monads

From Dev

Continue even after Fatal error: Uncaught exception

From Dev

Haskell IO error handling during IO operation

From Dev

Why doesn't Haskell sequence these IO actions properly?

From Dev

Why doesn't Haskell sequence these IO actions properly?

From Dev

How to properly ignore exception in Java?

From Dev

how to ignore error in jmeter

Related Related

HotTag

Archive