001/*
002 * Copyright 2002-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.reactive.function.client;
018
019import java.nio.charset.Charset;
020
021import org.springframework.http.HttpHeaders;
022import org.springframework.http.HttpRequest;
023import org.springframework.lang.Nullable;
024
025/**
026 * Exception thrown when an unknown (or custom) HTTP status code is received.
027 *
028 * @author Brian Clozel
029 * @since 5.1
030 */
031public class UnknownHttpStatusCodeException extends WebClientResponseException {
032
033        private static final long serialVersionUID = 2407169540168185007L;
034
035
036        /**
037         * Create a new instance of the {@code UnknownHttpStatusCodeException} with the given
038         * parameters.
039         */
040        public UnknownHttpStatusCodeException(
041                        int statusCode, HttpHeaders headers, byte[] responseBody, Charset responseCharset) {
042
043                super("Unknown status code [" + statusCode + "]", statusCode, "",
044                                headers, responseBody, responseCharset);
045        }
046
047        /**
048         * Create a new instance of the {@code UnknownHttpStatusCodeException} with the given
049         * parameters.
050         * @since 5.1.4
051         */
052        public UnknownHttpStatusCodeException(
053                        int statusCode, HttpHeaders headers, byte[] responseBody, Charset responseCharset,
054                        @Nullable HttpRequest request) {
055
056                super("Unknown status code [" + statusCode + "]", statusCode, "",
057                                headers, responseBody, responseCharset, request);
058        }
059
060}