Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save namila007/103e0a6bf051d8e19936bf3f206965c0 to your computer and use it in GitHub Desktop.
Save namila007/103e0a6bf051d8e19936bf3f206965c0 to your computer and use it in GitHub Desktop.
model
@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