Created
March 29, 2019 04:31
-
-
Save namila007/103e0a6bf051d8e19936bf3f206965c0 to your computer and use it in GitHub Desktop.
model
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 | |
class ApiError | |
{ | |
private HttpStatus status; | |
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT) | |
private LocalDateTime timestamp; | |
private String message; | |
private String debugMessage; | |
private ApiError() | |
{ | |
timestamp = LocalDateTime.now(); | |
} | |
ApiError( HttpStatus status ) | |
{ | |
this(); | |
this.status = status; | |
} | |
ApiError( HttpStatus status, Throwable ex ) | |
{ | |
this(); | |
this.status = status; | |
this.message = "Unexpected error"; | |
this.debugMessage = ex.getLocalizedMessage(); | |
} | |
ApiError( HttpStatus status, String message, Throwable ex ) | |
{ | |
this(); | |
this.status = status; | |
this.message = message; | |
this.debugMessage = ex.getLocalizedMessage(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment