001package com.nimbusds.openid.connect.provider.spi.reg; 002 003 004import org.checkerframework.checker.nullness.qual.Nullable; 005 006import com.nimbusds.oauth2.sdk.http.HTTPResponse; 007 008 009/** 010 * Exception with a wrapped HTTP response. 011 */ 012public class WrappedHTTPResponseException extends Exception { 013 014 015 /** 016 * The wrapped HTTP response. 017 */ 018 private final HTTPResponse httpResponse; 019 020 021 /** 022 * Creates a new wrapped HTTP response exception. 023 * 024 * @param message Optional message to log, {@code null} if not 025 * specified. 026 * @param httpResponse The wrapped HTTP response, must not be 027 * {@code null}. 028 */ 029 public WrappedHTTPResponseException(final @Nullable String message, final HTTPResponse httpResponse) { 030 super(message); 031 if (httpResponse == null) { 032 throw new IllegalArgumentException("The HTTP response must not be null"); 033 } 034 this.httpResponse = httpResponse; 035 } 036 037 038 /** 039 * Returns the wrapped HTTP response. 040 * 041 * @return The HTTP response. 042 */ 043 public HTTPResponse getHTTPResponse() { 044 return httpResponse; 045 } 046}