Skip to content

Commit 77f3880

Browse files
authored
Added custom exception
1 parent 0cc76ea commit 77f3880

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/main/java/at/jkvn/eventlib/EventLib.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import at.jkvn.eventlib.enumeration.EventPriority;
66
import at.jkvn.eventlib.registry.Configuration;
77
import at.jkvn.eventlib.registry.ListenerRegistryType;
8+
import at.jkvn.eventlib.exception.AutomaticListenerException;
89
import lombok.Getter;
910
import lombok.SneakyThrows;
1011
import org.reflections.Reflections;
@@ -73,7 +74,7 @@ private static boolean isAutomatic() {
7374

7475
public static void registerListener(Listener listener) throws Exception {
7576
if(isAutomatic()) {
76-
throw new Exception("Cannot register listener on automatic mode"); //Todo: create custom exception
77+
throw new AutomaticListenerException("Cannot register listener on automatic mode");
7778
}
7879
listeners.add(listener);
7980
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package at.jkvn.eventlib.exception;
2+
3+
import java.lang.String;
4+
import java.lang.Exception;
5+
6+
public class AutomaticListenerException extends Exception {
7+
public AutomaticListenerException(String message) {
8+
super(message);
9+
}
10+
}

0 commit comments

Comments
 (0)