Files
nahodka-back/src/main/java/com/krylov/refound/exception/ApiException.java
2026-10-27 22:49:16 +03:00

26 lines
837 B
Java

package com.krylov.refound.exception;
import com.krylov.refound.enums.ErrorCode;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public class ApiException extends RuntimeException {
private final ErrorCode errorCode;
private final HttpStatus status;
/** Для 429: через сколько секунд повторить (заголовок Retry-After); null — не указывать. */
private final Long retryAfterSeconds;
public ApiException(ErrorCode errorCode, String message, HttpStatus status) {
this(errorCode, message, status, null);
}
public ApiException(ErrorCode errorCode, String message, HttpStatus status, Long retryAfterSeconds) {
super(message);
this.errorCode = errorCode;
this.status = status;
this.retryAfterSeconds = retryAfterSeconds;
}
}