Better error for mkColumn
This commit is contained in:
+2
-2
@@ -1,4 +1,3 @@
|
|||||||
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module PgStructure where
|
module PgStructure where
|
||||||
@@ -151,7 +150,6 @@ columns s t conn = do
|
|||||||
return cols
|
return cols
|
||||||
|
|
||||||
where
|
where
|
||||||
--TODO: handle failed pattern match with an appropriate exception
|
|
||||||
mkColumn [schema, table, name, pos, nullable, colT, updatable, maxlen, precision, defVal, enum] = Column (fromSql schema)
|
mkColumn [schema, table, name, pos, nullable, colT, updatable, maxlen, precision, defVal, enum] = Column (fromSql schema)
|
||||||
(fromSql table)
|
(fromSql table)
|
||||||
(fromSql name)
|
(fromSql name)
|
||||||
@@ -163,6 +161,8 @@ columns s t conn = do
|
|||||||
(fromSql precision)
|
(fromSql precision)
|
||||||
(fromSql defVal)
|
(fromSql defVal)
|
||||||
(splitOn "," <$> fromSql enum)
|
(splitOn "," <$> fromSql enum)
|
||||||
|
mkColumn _ = error $ "Incomplete column data received for table " ++
|
||||||
|
t ++ " in schema " ++ s ++ "."
|
||||||
|
|
||||||
printTables :: String -> Connection -> IO BL.ByteString
|
printTables :: String -> Connection -> IO BL.ByteString
|
||||||
printTables schema conn = JSON.encode <$> tables schema conn
|
printTables schema conn = JSON.encode <$> tables schema conn
|
||||||
|
|||||||
Reference in New Issue
Block a user