Skip to content

Commit 01e7ee7

Browse files
committed
make logs more useful
1 parent 7856a57 commit 01e7ee7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

codegen/src/main/kotlin/co/selim/ebservice/codegen/ServiceProcessor.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ class ServiceProcessor : AbstractProcessor() {
7171
logError("Function ${kmFunction.name} must be suspending")
7272
}
7373

74+
if(kmFunction.returnType.toTypeName() == Unit::class.asTypeName() && kmFunction.isSuspend) {
75+
logInfo("Function ${kmFunction.name} doesn't need to be suspending")
76+
}
77+
7478
val parameters = kmFunction.valueParameters
7579
.asSequence()
7680
.onEach { parameter ->
7781
if (parameter.varargElementType != null) {
78-
logError("Vararg parameters are not supported by ebservice")
82+
logError("Vararg parameters in function ${kmFunction.name} are not supported by ebservice")
7983
}
8084
}
8185
.filter { parameter ->
@@ -100,6 +104,10 @@ class ServiceProcessor : AbstractProcessor() {
100104
processingEnv.messager.printMessage(Diagnostic.Kind.ERROR, msg, element)
101105
}
102106

107+
private fun logInfo(msg: String, element: Element? = null) {
108+
processingEnv.messager.printMessage(Diagnostic.Kind.NOTE, msg, element)
109+
}
110+
103111
private fun KmType.toTypeName(): TypeName {
104112
val params: List<TypeName> = arguments.mapNotNull { typeProjection ->
105113
typeProjection.type?.toTypeName()?.copy(nullable = typeProjection.type!!.isNullable)

0 commit comments

Comments
 (0)