Skip to content

Commit

Permalink
Stable exception
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Dec 20, 2024
1 parent d76d226 commit 1b2548c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private[types] object ConverterProvider {
// Converter helpers
// =======================================================================
def cast(tree: Tree, tpe: Type): Tree = {
val msg = Constant(s"Cannot convert to ${tpe.typeSymbol.name}: ")
val msg = s"Cannot convert to ${tpe.typeSymbol.name}: "
val fail = q"""throw new _root_.java.lang.IllegalArgumentException($msg + $tree)"""

def readBase64(term: TermName) =
Expand Down Expand Up @@ -418,7 +418,7 @@ private[types] object ConverterProvider {

val tree = q"$fn.get($name)"
def nonNullTree(fType: String) = {
val msg = Constant(s"$fType field '$name' is null")
val msg = s"""$fType field "$name" is null"""
q"""{
val v = $fn.get($name)
if (v == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ConverterProviderTest extends AnyFlatSpec with Matchers {
"ConverterProvider" should "throw NPE with meaningful message for null in REQUIRED field" in {
the[NullPointerException] thrownBy {
Required.fromTableRow(TableRow())
} should have message "REQUIRED field 'a' is null"
} should have message """REQUIRED field "a" is null"""
}

it should "handle null in NULLABLE field" in {
Expand All @@ -39,7 +39,7 @@ class ConverterProviderTest extends AnyFlatSpec with Matchers {
it should "throw NPE with meaningful message for null in REPEATED field" in {
the[NullPointerException] thrownBy {
Repeated.fromTableRow(TableRow())
} should have message "REPEATED field 'a' is null"
} should have message """REPEATED field "a" is null"""
}

it should "handle required geography type" in {
Expand Down

0 comments on commit 1b2548c

Please sign in to comment.