1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Produce a better error when MiddleSnake fails to find a value.

This commit is contained in:
Rob Rix 2017-03-13 14:59:02 -04:00
parent cd051d8508
commit 2d7bdeff56

View File

@ -107,7 +107,11 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of
else
return (zipWith These (toList as) (toList bs))
MiddleSnake graph -> fmap (fromMaybe (error "bleah")) (for [0..maxD] (searchUpToD graph . EditDistance))
MiddleSnake graph -> do
result <- for [0..maxD] (searchUpToD graph . EditDistance)
case result of
Just result -> return result
Nothing -> error "MiddleSnake must always find a value."
SearchUpToD graph (EditDistance d) ->
(<|>) <$> for [negate d, negate d + 2 .. d] (searchAlongK graph (EditDistance d) Forward . Diagonal)