Skip to content

Commit 8da4412

Browse files
author
yevhenii-nadtochii
committed
Use multiline error messages for BoundFieldSupport checks
1 parent 43b1ad0 commit 8da4412

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

model/src/main/kotlin/io/spine/validation/bound/BoundFieldSupport.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import io.spine.protodata.ast.isList
4747
import io.spine.protodata.ast.name
4848
import io.spine.protodata.ast.qualifiedName
4949
import io.spine.protodata.check
50+
import io.spine.validation.RANGE
5051

5152
/**
5253
* Determines whether the field type can be validated with a range-constraining option.
@@ -65,9 +66,12 @@ internal object BoundFieldSupport {
6566
internal fun checkFieldType(field: Field, file: File, option: String): PrimitiveType {
6667
val primitive = field.type.extractPrimitive()
6768
Compilation.check(primitive in numericPrimitives, file, field.span) {
68-
"The field type `${field.type.name}` of `${field.qualifiedName}` is not supported by" +
69-
" the `($option)` option. Supported field types: numbers and repeated" +
70-
" of numbers."
69+
"""
70+
The `($option)` option was applied to a filed of unsupported type.
71+
Target field: `${field.qualifiedName}`.
72+
Field type: `${field.type.name}`.
73+
Supported field types: floating-point and integer numbers, repeated of numbers.
74+
""".trimIndent()
7175
}
7276
return primitive!!
7377
}

0 commit comments

Comments
 (0)