Skip to content

Commit c3612e9

Browse files
authored
feat: show better error message (#42)
1 parent 623968c commit c3612e9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/org/casbin/Client.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ public static String run(String... args) {
5454
return o.toString();
5555

5656
} catch (Exception e) {
57-
e.printStackTrace();
58-
System.out.println("Run './casbin --help or ./casbin -h' for usage.");
57+
Throwable cause = e.getCause();
58+
if (cause instanceof org.casbin.jcasbin.exception.CasbinMatcherException) {
59+
System.out.println(cause.getMessage());
60+
} else {
61+
e.printStackTrace();
62+
System.out.println("Run './casbin --help or ./casbin -h' for usage.");
63+
}
5964
System.exit(1);
6065
}
6166
return result;

0 commit comments

Comments
 (0)