All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.bitcoco.jsk.http.APIError Maven / Gradle / Ivy

There is a newer version: 0.4.4
Show newest version
package ca.bitcoco.jsk.http;


import java.time.LocalDateTime;


public class APIError {

    private String localTimestamp;
    private String message;
    private Object errorDetail;
    private String debugMessage;
    private int errorCode;

    private APIError() {
        localTimestamp = LocalDateTime.now().toString();
    }

    APIError(Throwable ex) {
        this();
        this.debugMessage = "Unexpected error";
        this.errorCode = 10000;
        if (ex != null) {
            this.message = ex.getMessage();
        }
    }

    APIError(Throwable ex, String debugMessage, int errorCode) {
        this();
        this.debugMessage = "Unexpected error";
        this.errorCode = 10000;
        if (errorCode != 0) {
            this.errorCode = errorCode;
        }
        if (debugMessage != null && !debugMessage.isEmpty()) {
            this.debugMessage = debugMessage;
        }
        if (ex != null) {
            this.message = ex.getMessage();
        }
    }

    public Object getErrorDetail() {
        return errorDetail;
    }

    public void setErrorDetail(Object errorDetail) {
        this.errorDetail = errorDetail;
    }

    public String getLocalTimestamp() {
        return localTimestamp;
    }

    public void setLocalTimestamp(String localTimestamp) {
        this.localTimestamp = localTimestamp;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getDebugMessage() {
        return debugMessage;
    }

    public void setDebugMessage(String debugMessage) {
        this.debugMessage = debugMessage;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy