java-tutorials/api-error-handling/api-error-object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data | |
@Builder | |
public class ApiError { | |
private LocalDateTime timestamp; | |
private String error; | |
private int errorCode; | |
@Singular | |
private List<ErrorCause> causes; | |
private ApiError(LocalDateTime timestamp, String error, int errorCode, List<ErrorCause> causes) { | |
this.timestamp = timestamp == null? LocalDateTime.now(): timestamp ; | |
this.error = error == null? "": error; | |
this.errorCode = errorCode; | |
this.causes = causes == null? Collections.emptyList(): causes; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment