001package ca.uhn.fhir.rest.server.exceptions;
002
003import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
004
005import ca.uhn.fhir.rest.api.Constants;
006import ca.uhn.fhir.util.CoverageIgnore;
007
008/*
009 * #%L
010 * HAPI FHIR - Core Library
011 * %%
012 * Copyright (C) 2014 - 2023 Smile CDR, Inc.
013 * %%
014 * Licensed under the Apache License, Version 2.0 (the "License");
015 * you may not use this file except in compliance with the License.
016 * You may obtain a copy of the License at
017 *
018 *      http://www.apache.org/licenses/LICENSE-2.0
019 *
020 * Unless required by applicable law or agreed to in writing, software
021 * distributed under the License is distributed on an "AS IS" BASIS,
022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
023 * See the License for the specific language governing permissions and
024 * limitations under the License.
025 * #L%
026 */
027
028/**
029 * Represents an <b>HTTP 400 Bad Request</b> response.
030 * This status indicates that the client's message was invalid (e.g. not a valid FHIR Resource
031 * per the specifications), as opposed to the {@link UnprocessableEntityException} which indicates
032 * that data does not pass business rule validation on the server.
033 * 
034 * <p>
035 * Note that a complete list of RESTful exceptions is available in the
036 * <a href="./package-summary.html">Package Summary</a>.
037 * </p>
038 * 
039 * @see UnprocessableEntityException Which should be used for business level validation failures
040 */
041@CoverageIgnore
042public class InvalidRequestException extends BaseServerResponseException {
043
044        public static final int STATUS_CODE = Constants.STATUS_HTTP_400_BAD_REQUEST;
045        private static final long serialVersionUID = 1L;
046
047        /**
048         * Constructor
049         */
050        public InvalidRequestException(String theMessage) {
051                super(STATUS_CODE, theMessage);
052        }
053
054        /**
055         * Constructor
056         */
057        public InvalidRequestException(String theMessage, Throwable theCause) {
058                super(STATUS_CODE, theMessage, theCause);
059        }
060
061        /**
062         * Constructor
063         */
064        public InvalidRequestException(Throwable theCause) {
065                super(STATUS_CODE, theCause);
066        }
067        
068        /**
069         * Constructor
070         * 
071         * @param theMessage
072         *            The message
073         *  @param theOperationOutcome The OperationOutcome resource to return to the client
074         */
075        public InvalidRequestException(String theMessage, IBaseOperationOutcome theOperationOutcome) {
076                super(STATUS_CODE, theMessage, theOperationOutcome);
077        }
078
079
080}