com.geotab.http.exception.DbUnavailableException Maven / Gradle / Ivy
/*
*
* 2020 Copyright (C) Geotab Inc. All rights reserved.
*/
package com.geotab.http.exception;
import com.geotab.model.enumeration.DbUnavailableState;
import lombok.Getter;
/**
* This exception occurs if the system makes a database request that could not succeed because of
* connection failure or data change.
*/
public class DbUnavailableException extends JsonRpcErrorDataException {
@Getter
private DbUnavailableState state;
public DbUnavailableException() {
}
public DbUnavailableException(String message, Throwable cause) {
super(message, cause);
}
/**
* Initializes a new instance of the DbUnavailableException class.
*
* @param message The message
* @param cause The cause
* @param state The DbUnavailableState
*/
public DbUnavailableException(String message, Throwable cause, DbUnavailableState state) {
super(message, cause);
if (state == DbUnavailableState.NONE) {
throw new IllegalArgumentException(state.name());
}
this.state = state;
}
}