diff --git a/src/jvmMain/kotlin/ehn/techiop/hcert/kotlin/chain/impl/DefaultSchemaValidationService.kt b/src/jvmMain/kotlin/ehn/techiop/hcert/kotlin/chain/impl/DefaultSchemaValidationService.kt index c6393a88..d2334ae1 100644 --- a/src/jvmMain/kotlin/ehn/techiop/hcert/kotlin/chain/impl/DefaultSchemaValidationService.kt +++ b/src/jvmMain/kotlin/ehn/techiop/hcert/kotlin/chain/impl/DefaultSchemaValidationService.kt @@ -22,14 +22,13 @@ actual class DefaultSchemaValidationService : SchemaValidationService { val parser = Parser(uriResolver = { resource }) val schema = parser.parse(URI.create("dummy:///")) val result = schema.validateBasic(json) - result.errors?.let { - if (it.isNotEmpty()) { - //it.forEach { println("${it.error} - ${it.instanceLocation}") } - throw Throwable("Data does not follow schema: ${result.errors}") + result.errors?.let { error -> + if (error.isNotEmpty()) { + throw Throwable("Data does not follow schema: ${result.errors?.map { "${it.error}: ${it.keywordLocation}, ${it.instanceLocation}" }}") } } } catch (t: Throwable) { - verificationResult.error = Error.CBOR_DESERIALIZATION_FAILED + throw t.also { verificationResult.error = Error.CBOR_DESERIALIZATION_FAILED } } }