jooby/src/main/java/org/jooby/Err.java
public Map<String, Object> toMap(boolean stacktrace) {
    Status status = Status.valueOf(this.status);
    Throwable cause = Optional.ofNullable(getCause()).orElse(this);
    String message = Optional.ofNullable(cause.getMessage()).orElse(status.reason());

    Map<String, Object> err = new LinkedHashMap<>();
    err.put("message", message);
    if (stacktrace) {
      err.put("stacktrace", Throwables.getStackTraceAsString(cause).replace("\r", "").split("\\n"));
    }
    err.put("status", status.value());
    err.put("reason", status.reason());

    return err;
  }
public Map<String, Object> toMap(boolean stacktrace) {
    Status status = Status.valueOf(this.status);
    Throwable cause = Optional.ofNullable(getCause()).orElse(this);
    String message = Optional.ofNullable(cause.getMessage()).orElse(status.reason());

    Map<String, Object> err = new LinkedHashMap<>();
    err.put("message", message);
    if (stacktrace) {
      err.put("stacktrace", Throwables.getStackTraceAsString(cause).replace("\r", "").split("\\n"));
    }
    err.put("status", status.value());
    err.put("reason", status.reason());

    return err;
  }
Produces a friendly view of the err, resulting map has these attributes:

<pre>
message: exception message (if present)
stacktrace: array with the stacktrace
status: status code
reason: a status code reason
</pre>

@param stacktrace True for adding stacktrace.
@return A lightweight view of the err.