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
Often, a failure when parsing a string from a database column indicates not an expected bad input, but some sort of inconsistent or illegal state in the database, since data is validated on the way in (by convention). This happens so often over all our EntityRowConversion traits, that independent helper methods .
In referrals:
privatedefexpectValid[ADT](fromString: String=>Option[ADT], column: String)(
implicitadtClass: ClassTag[ADT]):ADT= {
fromString(column).getOrElse(thrownewDatabaseException(s"corrupted value found for $adtClass: $column"))
}
In payments:
defuseFromStringToConvertOrDie[T](converter: { deffromString(s: String):Option[T] }, fieldValue: String):T=
converter.fromString(fieldValue).getOrElse(thrownewIllegalStateException("Unrecognized field value."))
Elsewhere, ad-hoc Exceptions (not necessarly ServiceException) are thrown, and in far too many places, we skip error reporting altogether and fill in fake data, or otherwise hide the distinction between error and optional states:
Often, a failure when parsing a string from a database column indicates not an expected bad input, but some sort of inconsistent or illegal state in the database, since data is validated on the way in (by convention). This happens so often over all our EntityRowConversion traits, that independent helper methods .
In referrals:
In payments:
In advocates:
Elsewhere, ad-hoc Exceptions (not necessarly ServiceException) are thrown, and in far too many places, we skip error reporting altogether and fill in fake data, or otherwise hide the distinction between error and optional states:
Let's put something into
xyz.driver.core.database
and standardize. I recommend the first snippet with possible renaming.See also the more specific case of UUIDs: #82
The text was updated successfully, but these errors were encountered: