Skip to content

Commit

Permalink
Merge pull request #152 from Haskell-Things/more_debugging
Browse files Browse the repository at this point in the history
add more debugging messages in failure cases.
  • Loading branch information
julialongtin authored Jan 31, 2024
2 parents c30805a + 8148e2b commit 830f413
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Graphics/Slicer/Math/Skeleton/Definitions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ ancestorsOf :: INodeSet -> [INodeSet]
ancestorsOf (INodeSet children _)
| isEmpty children = []
| otherwise = case SL.last children of
[] -> error "encountered an empty generation."
[] -> [] -- error $ "encountered an empty generation: \n" <> show children <> "\n"
[a] -> [INodeSet (SL.init children) a]
newParents -> case SL.init children of
(Slist [] 0) -> INodeSet mempty <$> newParents
Expand Down
4 changes: 2 additions & 2 deletions Graphics/Slicer/Math/Skeleton/Face.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ getFaces' origINodeSet eNodeSet iNodeSet iNode = findFacesRecurse iNode myPLines
| isENode eNodeSet (fst pLine) = [] -- don't climb down an enode, you're done
| hasArc myINode && isCollinear (outAndErrOf myINode) pLine = [] -- don't try to climb back up the tree
| isNothing iNodeSet = error "we need INodes here."
| ancestorsOf (fromJust iNodeSet) /= [] = myGetFaces $ onlyOne $ filter (\a -> outAndErrOf (finalINodeOf a) == pLine) $ ancestorsOf (fromJust iNodeSet)
| not $ null (ancestorsOf $ fromJust iNodeSet) = myGetFaces $ onlyOne $ filter (\a -> outAndErrOf (finalINodeOf a) == pLine) $ ancestorsOf (fromJust iNodeSet)
| otherwise = error "no between to plant?"
where
onlyOne :: (Show a) => [a] -> a
onlyOne [] = error "no item"
onlyOne [] = error $ "no item!\n" <> show pLine <> "\n" <> show iNodeSet <> "\n"
onlyOne [a] = a
onlyOne xs = error $ "too many items." <> show xs <> "\n"
myGetFaces newINodeSet
Expand Down

0 comments on commit 830f413

Please sign in to comment.