ing-bank/baker

Provide better error messages on invalid Kotlin interaction definitions

basdgrt opened this issue · 0 comments

For example when the possible outcome events are not a sealed hierarchy the error message is really vague:

Exception in thread "main" java.lang.NullPointerException
	at com.ing.baker.recipe.kotlindsl.Event.<init>(Event.scala:17)
	at com.ing.baker.recipe.kotlindsl.KotlinDslKt.toEvent(KotlinDsl.kt:465)
	at com.ing.baker.recipe.kotlindsl.KotlinDslKt.toEvent$default(KotlinDsl.kt:464)
	at com.ing.baker.recipe.kotlindsl.InteractionBuilder.extractOutputEvents(KotlinDsl.kt:280)
	at com.ing.baker.recipe.kotlindsl.InteractionBuilder.build(KotlinDsl.kt:262)
	at nl.ing.recipe.accountholder.recipe.MainRecipeKt$main$recipe$1.invoke(MainRecipe.kt:232)
	at nl.ing.recipe.accountholder.recipe.MainRecipeKt$main$recipe$1.invoke(MainRecipe.kt:33)
	at com.ing.baker.recipe.kotlindsl.KotlinDslKt.recipe(KotlinDsl.kt:35)
	at nl.ing.recipe.accountholder.recipe.MainRecipeKt.main(MainRecipe.kt:33)
	at nl.ing.recipe.accountholder.recipe.MainRecipeKt.main(MainRecipe.kt)

We should improve on this and give some pointers on possible fixes. At least mention the interaction name which results in this problem.