You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Use uname -a if on Linux.
JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
Adopt JDK 11
Library Dependencies
N/A
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
Use the scalar[Int].single on a column that unexpectedly contains a NULL
An error is thrown that says the column unexpectedly contains a null
Actual Behavior
Use the scalar[Int].single on a column that unexpectedly contains a NULL
This error is thrown: anorm.AnormException: '.completed_average' not found, available columns: completed_average, completed_average
The error makes it look like there was an issue with column name or column alias etc. The actual issue was that the column unexpectedly contains a NULL and the scalar[Option[Int]].single needs to be used instead
The issue seems to be with this code in Anorm:
@inline privatedefparseColumn[T](
row: Row,
name: String,
c: Column[T],
input: (Any, MetaDataItem)
):Either[SqlRequestError, T] = c.tupled(input).left.map {
caseUnexpectedNullableFound(_) =>ColumnNotFound(name, row)
case cause => cause
}
The UnexpectedNullableFound error is incorrectly mapped to the ColumnNotFound error
Reproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.
The text was updated successfully, but these errors were encountered:
simondean
changed the title
Misleading error message when column is unexpectedly NULL
Incorrect error message when column is unexpectedly NULL
Jun 23, 2023
Are you looking for help?
No
Anorm Version (2.5.x / etc)
2.7.0 (latest version)
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Use
uname -a
if on Linux.JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
Adopt JDK 11
Library Dependencies
N/A
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
scalar[Int].single
on a column that unexpectedly contains a NULLActual Behavior
scalar[Int].single
on a column that unexpectedly contains a NULLanorm.AnormException: '.completed_average' not found, available columns: completed_average, completed_average
scalar[Option[Int]].single
needs to be used insteadThe issue seems to be with this code in Anorm:
The
UnexpectedNullableFound
error is incorrectly mapped to theColumnNotFound
errorReproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.
The text was updated successfully, but these errors were encountered: