Search in sources :

Example 1 with ExceptionWithContext

use of com.djrapitops.plan.exceptions.ExceptionWithContext in project Plan by plan-player-analytics.

the class InternalErrorPage method createContent.

private String createContent() {
    TextStringBuilder paragraph = new TextStringBuilder();
    paragraph.append("Please report this issue here: ");
    paragraph.append(Html.LINK.create("https://github.com/plan-player-analytics/Plan/issues", "Issues"));
    paragraph.append("<br><br><pre>");
    paragraph.append(error).append(" | ").append(errorMsg);
    if (error instanceof ExceptionWithContext) {
        ((ExceptionWithContext) error).getContext().ifPresent(context -> paragraph.append(context.getWhatToDo().map(whatToDo -> "<br>What to do about it: " + whatToDo).orElse("<br>Error message: " + error.getMessage())).append("<br><br>Related things:<br>").appendWithSeparators(context.toLines(), "<br>").append("<br>"));
    }
    for (StackTraceElement element : error.getStackTrace()) {
        paragraph.append("<br>");
        paragraph.append("    ").append(element);
    }
    if (error.getCause() != null) {
        appendCause(error.getCause(), paragraph);
    }
    paragraph.append("</pre>");
    return paragraph.toString();
}
Also used : ExceptionWithContext(com.djrapitops.plan.exceptions.ExceptionWithContext) TextStringBuilder(org.apache.commons.text.TextStringBuilder)

Aggregations

ExceptionWithContext (com.djrapitops.plan.exceptions.ExceptionWithContext)1 TextStringBuilder (org.apache.commons.text.TextStringBuilder)1