1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Include more info in ParserTimedOut

This commit is contained in:
Timothy Clem 2018-08-30 10:17:59 -07:00
parent d38e453a05
commit f792b93b89

View File

@ -65,6 +65,7 @@ import Data.Bool
import Data.ByteString.Builder import Data.ByteString.Builder
import Data.Diff import Data.Diff
import qualified Data.Error as Error import qualified Data.Error as Error
import Data.Language (Language)
import Data.Record import Data.Record
import Data.Source (Source) import Data.Source (Source)
import Data.Sum import Data.Sum
@ -195,7 +196,8 @@ runTaskF = interpret $ \ task -> case task of
logError :: Member Telemetry effs => Config -> Level -> Blob -> Error.Error String -> [(String, String)] -> Eff effs () logError :: Member Telemetry effs => Config -> Level -> Blob -> Error.Error String -> [(String, String)] -> Eff effs ()
logError Config{..} level blob err = writeLog level (Error.formatError configLogPrintSource configIsTerminal blob err) logError Config{..} level blob err = writeLog level (Error.formatError configLogPrintSource configIsTerminal blob err)
data ParserCancelled = ParserTimedOut deriving (Show, Typeable) data ParserCancelled = ParserTimedOut FilePath Language
deriving (Show, Typeable)
instance Exception ParserCancelled instance Exception ParserCancelled
@ -206,7 +208,7 @@ runParser blob@Blob{..} parser = case parser of
time "parse.tree_sitter_ast_parse" languageTag $ do time "parse.tree_sitter_ast_parse" languageTag $ do
config <- ask config <- ask
parseToAST (configTreeSitterParseTimeout config) language blob parseToAST (configTreeSitterParseTimeout config) language blob
>>= maybeM (throwError (SomeException ParserTimedOut)) >>= maybeM (throwError (SomeException (ParserTimedOut blobPath blobLanguage)))
AssignmentParser parser assignment -> runAssignment Assignment.assign parser assignment AssignmentParser parser assignment -> runAssignment Assignment.assign parser assignment
DeterministicParser parser assignment -> runAssignment Deterministic.assign parser assignment DeterministicParser parser assignment -> runAssignment Deterministic.assign parser assignment