Created
August 31, 2016 14:12
-
-
Save jonathanjouty/b2476ebda372cf7df942ece062682fab to your computer and use it in GitHub Desktop.
Shake Exception Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Exception | |
import Data.Typeable | |
import Development.Shake | |
import System.IO | |
import System.Environment | |
main :: IO () | |
main = do | |
print "Starting..." | |
withArgs ["--exception"] (shakeArgs shakeOptions myRules) `catch` things | |
where | |
things :: ShakeException -> IO () | |
things e = do | |
hPutStrLn stderr "--Exception--" | |
hPutStrLn stderr $ show $ typeOf e | |
hPutStrLn stderr $ (++) "T: " $ shakeExceptionTarget e | |
hPutStrLn stderr $ (++) "S: " $ concat $ shakeExceptionStack e | |
hPutStrLn stderr $ (++) "I: " $ show $ shakeExceptionInner e | |
myRules :: Rules () | |
myRules = do | |
want ["boogey-man"] | |
"boogey-man" ~> do | |
need ["real"] | |
cmd "echo hey" | |
"real" ~> do | |
need ["fake"] | |
cmd "echo real" | |
"fake" ~> do | |
cmd "does-not-exist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment