for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package unicon.matthews.common;
import java.util.Date;
import org.springframework.http.HttpStatus;
/**
* Error model for interacting with client.
*
* @author vladimir.stankovic
* Aug 3, 2016
*/
public class ErrorResponse {
// HTTP Response Status Code
private final HttpStatus status;
// General Error message
private final String message;
// Error code
private final ErrorCode errorCode;
private final Date timestamp;
protected ErrorResponse(final String message, final ErrorCode errorCode, HttpStatus status) {
this.message = message;
this.errorCode = errorCode;
this.status = status;
this.timestamp = new java.util.Date();
}
public static ErrorResponse of(final String message, final ErrorCode errorCode, HttpStatus status) {
return new ErrorResponse(message, errorCode, status);
public Integer getStatus() {
return status.value();
public String getMessage() {
return message;
public ErrorCode getErrorCode() {
return errorCode;
public Date getTimestamp() {
return timestamp;