Capturing errors
Uncaught exceptions and crashes are reported automatically. Use the client for errors you catch yourself.
Exceptions
try {
loadConfig();
} catch (IOException e) {
ExampleMod.NITEA.captureException(e);
}
Pass a level and extra tags for this event only:
import cc.nitea.Level;
import java.util.Map;
ExampleMod.NITEA.captureException(e, Level.WARNING);
ExampleMod.NITEA.captureException(e, Level.WARNING, Map.of("file", path.getFileName().toString()));
Exceptions you pass to captureException are always reported by your mod, even when the stack trace points at another mod: you chose to send them.
Messages
Report something that isn't an exception, like a failed sanity check:
ExampleMod.NITEA.captureMessage("Energy network has no controller", Level.WARNING);
Return value
Each call returns the event's UUID, which you can log or show to the player. It returns null when nothing was sent:
- there's no SDK key, or the key was rejected
- the player chose Don't allow, or turned your mod off
- the event was rate limited
- the exception is
nullor the message is empty
While the player hasn't chosen yet, events wait in memory (up to 25 per mod) and are sent if they allow reporting. The UUID is still returned.
Rate limits
Nitea keeps an error thrown every tick from flooding your dashboard. Per mod, at most 30 events a minute are sent, and at most 3 a minute with the same signature. Report once rather than relying on it.
What comes with every event
- The stack trace, with your mod's frames marked
- Minecraft, loader (NeoForge, Forge or Fabric) and Java versions, OS, CPU architecture, CPU cores and maximum memory
- Your mod's release, the environment (
productionordevelopment) and the side (client or server) - Your breadcrumbs and tags
- A random installation ID, used to count how many players an issue affects
How events are grouped
Events are grouped into issues by exception type and your mod's own stack frames. Line numbers are ignored, so small code changes don't split an issue.