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; } }