File tree Expand file tree Collapse file tree
src/main/java/io/github/doblon8/openpnp/capture Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,8 +58,15 @@ public static void setLogLevel(LogLevel level) {
5858 * which will be called for each log message generated by the library.
5959 */
6060 public static void installCustomLogFunction (BiConsumer <LogLevel , String > logFunction ) {
61- MemorySegment functionPointer = CapCustomLogFunc .allocate ((level , stringPointer ) ->
62- logFunction .accept (LogLevel .fromNative (level ), stringPointer .getString (0 )), arena );
61+ MemorySegment functionPointer = CapCustomLogFunc .allocate ((level , stringPointer ) -> {
62+ try {
63+ LogLevel logLevel = LogLevel .fromNative (level );
64+ String message = stringPointer .getString (0 );
65+ logFunction .accept (logLevel , message );
66+ } catch (Throwable t ) {
67+ t .printStackTrace (System .err );
68+ }
69+ }, arena );
6370 Cap_installCustomLogFunction (functionPointer );
6471 }
6572
You can’t perform that action at this time.
0 commit comments