Skip to content

Commit 5c9c24f

Browse files
fix: improve lookup exception handling
1 parent 6928e75 commit 5c9c24f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ private static SymbolLookup findLibrary(Arena arena) {
2828
try {
2929
var library = System.mapLibraryName("tree-sitter");
3030
return SymbolLookup.libraryLookup(library, arena);
31-
} catch (IllegalArgumentException e) {
32-
return SymbolLookup.loaderLookup();
31+
} catch (IllegalArgumentException ex1) {
32+
try {
33+
return SymbolLookup.loaderLookup();
34+
} catch (UnsatisfiedLinkError ex2) {
35+
ex1.addSuppressed(ex2);
36+
throw ex1;
37+
}
3338
}
3439
}
3540
}

0 commit comments

Comments
 (0)