utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
560 stars 38 forks source link

Add better jni error reporting inside the godot editor #627

Closed chippmann closed 1 month ago

chippmann commented 1 month ago

This improves the jni error reporting inside the godot editor by grabbing the stacktrace from the jvm and printing them using the godot print commands. Only applies to tool mode. In all other cases, we still print the error using the jni provided method which just prints to the console.

2024-05-10T12:05:06,018362263+02:00 2024-05-10T11:57:53,693923600+02:00 2024-05-10T12:04:09,201022038+02:00 2024-05-10T12:00:49,301472094+02:00

CedNaru commented 1 month ago

There is a partial conflict with my new PR. I made the JNI check optional for method calls and instead use a try catch directly on the Kotlin side. It's more efficient to catch exception when possible directly from the JVM instead of doing it from the C++ side. See: https://github.com/utopia-rise/godot-kotlin-jvm/pull/626/commits/fd5fbb2a3eeb43dec6ffc6240da3c0ca7545a93b

chippmann commented 1 month ago

There is a partial conflict with my new PR. I made the JNI check optional for method calls and instead use a try catch directly on the Kotlin side. It's more efficient to catch exception when possible directly from the JVM instead of doing it from the C++ side. See: fd5fbb2

Ok for me. I'll just wait with this PR until yours is merged and then fix and rebase