Skip to main content
xyz.refineryteam.refinerycore.api.crash turns raw stack traces into actionable reports. A CrashHandler matches thrown exceptions against registered CrashHints — each hint recognizes a class of failure and carries a headline, extracted context fields, and human guidance lines (“what you can try”) printed alongside the stack trace. Plugins extending RefineryPlugin receive a handler from onLoad() through getCrashHandler(). RefineryCorePlugin uses that handler for failed startup steps and configuration reloads, and registers default hints for database, I/O, missing-class, API mismatch, illegal-state, and null-pointer failures.
Every report line goes through the plugin’s Logger rather than raw stdout, so timestamps, thread names, and log levels stay intact — the report reads like any other server log output instead of an interleaved block.

Basic usage

MyPlugin.java
A matching report prints a boxed headline, the exception message and root cause, any extracted context fields, the hint’s help bullets, and the full stack trace with causes. Reports are also appended to logs/refinery-crash-reports.txt for post-mortem reading, since console spam scrolls away.

CrashHint

Each hint is built fluently: Register more specific hints before general ones — the first matching hint wins, and a report without any matching hint falls back to a generic "Unhandled exception" headline.

CrashHandler

Wrap report(...) calls around the operations most likely to fail at runtime — database access, web requests, file I/O. Since hints carry the troubleshooting steps, this is also a good place to encode knowledge that currently lives in your head or your support Discord.