From 7d8c7fc9360d2e483a413478e99d05537e1f13fa Mon Sep 17 00:00:00 2001 From: bbalint <36666565+balintbekefi@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:22:29 +0100 Subject: [PATCH] Improve ErrorData building Distinction between ErrorData title and detail --- .../java/io/crnk/core/engine/error/ExceptionMapperHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crnk-core/src/main/java/io/crnk/core/engine/error/ExceptionMapperHelper.java b/crnk-core/src/main/java/io/crnk/core/engine/error/ExceptionMapperHelper.java index 8618d1259..0fd6eaa02 100644 --- a/crnk-core/src/main/java/io/crnk/core/engine/error/ExceptionMapperHelper.java +++ b/crnk-core/src/main/java/io/crnk/core/engine/error/ExceptionMapperHelper.java @@ -22,7 +22,8 @@ public static ErrorResponse toErrorResponse(Throwable exception, int statusCode, builder = builder.addMetaField(ExceptionMapperHelper.META_TYPE_KEY, metaTypeValue); builder = builder.setStatus(String.valueOf(statusCode)); builder = builder.setCode(exception.getMessage()); - builder = builder.setTitle(exception.getLocalizedMessage()); + builder = builder.setDetail(exception.getLocalizedMessage()); + builder = builder.setTitle(exception.getCause().getClass().getSimpleName()); ErrorData error = builder.build(); errors.add(error);