Skip to content

Commit c6af4a4

Browse files
committed
Fix core errors in throw(type, string) with invalid type
Fix core errors in `throw(type, string)` when passing non-exception types.
1 parent 9ecb896 commit c6af4a4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/com/laytonsmith/core/functions/Exceptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommand
358358
} catch (ClassNotFoundException ex) {
359359
throw new CREFormatException("Expected a valid exception type, but found \"" + args[0].val() + "\"", t);
360360
}
361+
if(!CREThrowable.class.isAssignableFrom(c)) {
362+
throw new CREFormatException("Expected a valid exception type, but found \"" + args[0].val() + "\"", t);
363+
}
361364
List<Class> classes = new ArrayList<>();
362365
List<Object> arguments = new ArrayList<>();
363366
classes.add(String.class);

0 commit comments

Comments
 (0)