{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Language.Ninja.Errors
(
NinjaError (..)
, throwNinjaError
, throwGenericNinjaError
, throwNinjaParseError
, throwNinjaCompileError
, CompileError (..)
, throwCompileError
, throwGenericCompileError
, CompileMetaError (..)
, throwCompileMetaError
, throwGenericCompileMetaError
, throwVersionParseFailure
, CompilePhonyError (..)
, throwCompilePhonyError
, throwGenericCompilePhonyError
, CompileDefaultError (..)
, throwCompileDefaultError
, throwGenericCompileDefaultError
, CompileBuildError (..)
, throwCompileBuildError
, throwGenericCompileBuildError
, throwBuildRuleNotFound
, CompileRuleError (..)
, throwCompileRuleError
, throwGenericCompileRuleError
, throwRuleLookupFailure
, throwUnknownDeps
, throwUnexpectedMSVCPrefix
, CompilePoolError (..)
, throwCompilePoolError
, throwGenericCompilePoolError
, throwInvalidPoolDepth
, throwEmptyPoolName
, ParseError (..)
, throwParseError
, throwGenericParseError
, throwLexBindingFailure
, throwLexExpectedColon
, throwLexUnexpectedDollar
, throwLexUnexpectedSeparator
, throwLexParsecError
, throwParseBadDepthField
, throwParseUnexpectedBinding
) where
import Language.Ninja.Errors.Compile
import Language.Ninja.Errors.Parser
import Control.Exception (Exception)
import Control.Monad.Error.Class (MonadError (..))
import Data.Text (Text)
import GHC.Generics (Generic)
data NinjaError
=
GenericNinjaError !Text
|
NinjaParseError !ParseError
|
NinjaCompileError !CompileError
deriving (Eq, Show, Generic)
instance Exception NinjaError
throwNinjaError :: (MonadError NinjaError m) => NinjaError -> m a
throwNinjaError = throwError
throwGenericNinjaError :: (MonadError NinjaError m) => Text -> m a
throwGenericNinjaError msg = throwNinjaError (GenericNinjaError msg)
throwNinjaParseError :: (MonadError NinjaError m) => ParseError -> m a
throwNinjaParseError e = throwNinjaError (NinjaParseError e)
throwNinjaCompileError :: (MonadError NinjaError m) => CompileError -> m a
throwNinjaCompileError e = throwNinjaError (NinjaCompileError e)