jodd-madvoc/src/main/java/jodd/madvoc/result/JsonResult.java
public static JsonResult of(final Exception exception) {
		final HashMap<String, Object> errorMap = new HashMap<>();

		errorMap.put("message", ExceptionUtil.message(exception));
		errorMap.put("error", exception.getClass().getName());
		errorMap.put("cause", exception.getCause() != null ? exception.getCause().getClass().getName() : null);

		final ArrayList<String> details = new ArrayList<>();

		final StackTraceElement[] ste = ExceptionUtil.getStackTrace(exception, null, null);
		for (StackTraceElement stackTraceElement : ste) {
			details.add(stackTraceElement.toString());
		}

		errorMap.put("details", details);

		final String json = JsonSerializer.create().deep(true).serialize(errorMap);
		return new JsonResult(json).status(HttpStatus.error500().internalError());
	}
public static JsonResult of(final Exception exception) {
		final HashMap<String, Object> errorMap = new HashMap<>();

		errorMap.put("message", ExceptionUtil.message(exception));
		errorMap.put("error", exception.getClass().getName());
		errorMap.put("cause", exception.getCause() != null ? exception.getCause().getClass().getName() : null);

		final ArrayList<String> details = new ArrayList<>();

		final StackTraceElement[] ste = ExceptionUtil.getStackTrace(exception, null, null);
		for (StackTraceElement stackTraceElement : ste) {
			details.add(stackTraceElement.toString());
		}

		errorMap.put("details", details);

		final String json = JsonSerializer.create().deep(true).serialize(errorMap);
		return new JsonResult(json).status(HttpStatus.error500().internalError());
	}
Creates a JSON response from an exception. Response body will have information about the
exception and response status will be set to 500.