onError :: Action () -> Action () -> Action ()
onError act catch = do
    emit ClearErrors
    scope act
    end <- newLabel
    err <- newLabel
    emit $ IfErrors err end
    label err
    scope catch
    label end


-- | Checks for existence of file(s) (which can be a wildcard, or a directory).
--   If you want to check to see if a file is a directory, use @fileExists "DIRECTORY/*.*"@.
--
-- > iff_ (fileExists "$WINDIR/notepad.exe") $
-- >     messageBox [MB_OK] "notepad is installed"
onError :: Action () -> Action () -> Action ()
onError act catch = do
    emit ClearErrors
    scope act
    end <- newLabel
    err <- newLabel
    emit $ IfErrors err end
    label err
    scope catch
    label end


-- | Checks for existence of file(s) (which can be a wildcard, or a directory).
--   If you want to check to see if a file is a directory, use @fileExists "DIRECTORY/*.*"@.
--
-- > iff_ (fileExists "$WINDIR/notepad.exe") $
-- >     messageBox [MB_OK] "notepad is installed"
onError act catch = do
    emit ClearErrors
    scope act
    end <- newLabel
    err <- newLabel
    emit $ IfErrors err end
    label err
    scope catch
    label end


-- | Checks for existence of file(s) (which can be a wildcard, or a directory).
--   If you want to check to see if a file is a directory, use @fileExists "DIRECTORY/*.*"@.
--
-- > iff_ (fileExists "$WINDIR/notepad.exe") $
-- >     messageBox [MB_OK] "notepad is installed"