Extend ExceptionInfo with map info + EntityNotFound info (#1901)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-10-17 16:51:29 +03:00
committed by GitHub
parent 331cf8e692
commit 60ee383158
5 changed files with 75 additions and 110 deletions

View File

@@ -268,9 +268,8 @@ public class ResponseExceptionHandler {
response.setExceptionClass(ex.getClass().getName());
if (ex instanceof AbstractServerRtException) {
response.setErrorCode(((AbstractServerRtException) ex).getError().getKey());
response.setInfo(((AbstractServerRtException) ex).getInfo());
}
return response;
}
}
}

View File

@@ -9,81 +9,22 @@
*/
package org.eclipse.hawkbit.rest.json.model;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Data;
/**
* A exception model rest representation with JSON annotations for response
* bodies in case of RESTful exception occurrence.
*
*/
@Data
@JsonInclude(Include.NON_EMPTY)
public class ExceptionInfo {
private String exceptionClass;
private String errorCode;
private String message;
private List<String> parameters;
/**
* @return the exceptionClass
*/
public String getExceptionClass() {
return exceptionClass;
}
/**
* @param exceptionClass
* the exceptionClass to set
*/
public void setExceptionClass(final String exceptionClass) {
this.exceptionClass = exceptionClass;
}
/**
* @return the parameters
*/
public List<String> getParameters() {
return parameters;
}
/**
* @param parameters
* the parameters to set
*/
public void setParameters(final List<String> parameters) {
this.parameters = parameters;
}
/**
* @return the errorCode
*/
public String getErrorCode() {
return errorCode;
}
/**
* @param errorCode
* the errorCode to set
*/
public void setErrorCode(final String errorCode) {
this.errorCode = errorCode;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(final String message) {
this.message = message;
}
private Map<String, Object> info;
}