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