package com.unibuy.smartdevice.exception;

import androidx.annotation.NonNull;

public class LogsException extends Exception {
    private Logs logs;
    private ErrorCode errorCode;
    public ErrorCode getErrorCode() {
        return errorCode;
    }

    public LogsException(Logs logs, String message) {
        super(message);
        this.logs = logs;
    }
    public LogsException(Logs logs, ErrorCode errorCode) {
        this(logs, errorCode.getMessage());
        this.errorCode = errorCode;
    }
    public LogsException(Logs logs, ErrorCode errorCode, String message) {
        this(logs, errorCode.getMessage()+"/"+message);
        this.errorCode = errorCode;
    }
    public LogsException(Logs logs, Throwable cause) {
        this(logs, "e:"+cause.getMessage());
        this.errorCode = ErrorCode.UNKNOWN_ERROR;
    }
    public LogsException(Logs logs, String message, ErrorCode errorCode) {
        this(logs, message);
        this.errorCode = errorCode;
    }
    public LogsException(Logs logs, String message, Throwable cause) {
        this(logs, message+" e:"+cause.getMessage());
        this.errorCode = ErrorCode.UNKNOWN_ERROR;
    }
    public LogsException(Logs logs, ErrorCode errorCode, Throwable cause) {
        this(logs, "e:"+cause.getMessage());
        this.errorCode = errorCode;
    }
    public LogsException(Logs logs, String message, ErrorCode errorCode, Throwable cause) {
        this(logs, message+" e:"+cause.getMessage());
        this.errorCode = errorCode;
    }

    public Logs getLogs() {
        return logs;
    }
}
