Skip to content

Commit

Permalink
Merge pull request #696 from codedownio/improve-column-type-mismatch
Browse files Browse the repository at this point in the history
Improved error for ColumnTypeMismatch
  • Loading branch information
LaurentRDC authored Jul 9, 2024
2 parents c6a16b6 + f1dbdae commit 7e69397
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions beam-postgres/Database/Beam/Postgres/Connection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ runPgRowReader conn rowIdx res fields (FromBackendRowM readRow) =
case pgErr of
Pg.ConversionFailed { Pg.errSQLType = sql
, Pg.errHaskellType = hs
, Pg.errMessage = msg } ->
pure (ColumnTypeMismatch hs sql msg)
, Pg.errMessage = msg
, Pg.errSQLField = field } ->
pure (ColumnTypeMismatch hs sql ("Conversion failed for field'" <> field <> "': " <> msg))
Pg.Incompatible { Pg.errSQLType = sql
, Pg.errHaskellType = hs
, Pg.errMessage = msg } ->
pure (ColumnTypeMismatch hs sql msg)
, Pg.errMessage = msg
, Pg.errSQLField = field } ->
pure (ColumnTypeMismatch hs sql ("Incompatible field: '" <> field <> "': " <> msg))
Pg.UnexpectedNull {} ->
pure ColumnUnexpectedNull
in pure (Left (BeamRowReadError (Just (fromIntegral curCol)) err))
Expand Down

0 comments on commit 7e69397

Please sign in to comment.