Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error for ColumnTypeMismatch #696

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading