Skip to content

Commit 9690ee6

Browse files
committed
Improve logging and null handling in MockMetrics
1 parent 2b6fefc commit 9690ee6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/test/java/org/faststats/MockMetrics.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.gson.JsonObject;
44
import org.jspecify.annotations.NullMarked;
5+
import org.jspecify.annotations.Nullable;
56

67
import java.util.UUID;
78

@@ -15,9 +16,14 @@ public MockMetrics(UUID serverId, String token) {
1516
this.token = token;
1617
}
1718
@Override
18-
protected void error(String message, Throwable throwable) {
19+
protected void error(String message, @Nullable Throwable throwable) {
1920
System.err.println(message);
20-
throwable.printStackTrace(System.err);
21+
if (throwable != null) throwable.printStackTrace(System.err);
22+
}
23+
24+
@Override
25+
protected void warn(String message) {
26+
System.out.println(message);
2127
}
2228

2329
@Override

0 commit comments

Comments
 (0)