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