Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jonathanjouty
Created August 31, 2016 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanjouty/b2476ebda372cf7df942ece062682fab to your computer and use it in GitHub Desktop.
Save jonathanjouty/b2476ebda372cf7df942ece062682fab to your computer and use it in GitHub Desktop.
Shake Exception Test
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