Skip to content

Commit

Permalink
Clarify error message and description for hiedb function
Browse files Browse the repository at this point in the history
  • Loading branch information
josephsumabat committed Sep 18, 2023
1 parent f6eb22b commit 8dfba76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/StaticLS/HieDb.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import Data.List (intercalate)
import Database.SQLite.Simple
import HieDb

-- | Lookup 'HieModule' row from 'HieDb' given the path to the Haskell source file
-- | Lookup 'HieModule' row from 'HieDb' given the path to the Haskell hie file
-- A temporary function until this is supported in hiedb proper
lookupHieFileFromHie :: HieDb -> FilePath -> IO (Maybe HieModuleRow)
lookupHieFileFromHie (getConn -> conn) fp = do
files <- query conn "SELECT * FROM mods WHERE hieFile = ?" (Only fp)
Expand All @@ -15,7 +16,7 @@ lookupHieFileFromHie (getConn -> conn) fp = do
[x] -> return $ Just x
xs ->
error $
"DB invariant violated, hs_src in mods not unique: "
"DB invariant violated, hieFile in mods not unique: "
++ show fp
++ ". Entries: "
++ intercalate ", " (map (show . toRow) xs)

0 comments on commit 8dfba76

Please sign in to comment.