Skip to content

Better error message when defining a datatype for BQRead #246

@hamnis

Description

@hamnis

Sometimes when defining a derived bqread instance we might define the data type incorrectly,
now we can get error messages like:

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "other" is null
	at no.nrk.bigquery.BQRead$$anon$2.read(BQRead.scala:120)
	at no.nrk.bigquery.BQRead$$anon$2.read(BQRead.scala:114)
	at no.nrk.bigquery.BQReadCompat.no$nrk$bigquery$BQReadCompat$$anon$1$$_$read$$anonfun$1(BQReadCompat.scala:38)
	at scala.collection.ArrayOps$.map$extension(ArrayOps.scala:932)
	at scala.IArray$package$IArray$.map(IArray.scala:179)
	at magnolia1.CaseClassDerivation$ProductCaseClass.construct(impl.scala:57)
	at no.nrk.bigquery.BQReadCompat$$anon$1.read(BQReadCompat.scala:40)
	at no.nrk.bigquery.BigQueryClient.synchronousQuery$$anonfun$1$$anonfun$1(BigQueryClient.scala:111)

The error is here that we get an optional value for the field, but our datatype has defined this as
String

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions