Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Spring boot overriding the default white label error template with custom object
public class ExceptionResponse {
private Integer status;
private String path;
private String errorMessage;
private String timeStamp;
private String trace;
public ExceptionResponse(int status, Map<String, Object> errorAttributes) {
this.setPath((String) errorAttributes.get("path"));
this.setErrorMessage((String) errorAttributes.get("message"));
this.setTrace((String) errorAttributes.get("trace"));
public Integer getStatus() {
return status;
private void setStatus(Integer status) {
this.status = status;
public String getErrorMessage() {
return errorMessage;
private void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
public String getTimeStamp() {
return timeStamp;
private void setTimeStamp(String timeStamp) {
this.timeStamp = timeStamp;
public String getTrace() {
return trace;
private void setTrace(String trace) {
this.trace = trace;
public String getPath() {
return path;
private void setPath(String path) {
this.path = path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment