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 - 2017 University Health Network
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        public InvalidRequestException(String theMessage) {
048                super(STATUS_CODE, theMessage);
049        }
050        
051        /**
052         * Constructor
053         * 
054         * @param theMessage
055         *            The message
056         *  @param theOperationOutcome The OperationOutcome resource to return to the client
057         */
058        public InvalidRequestException(String theMessage, IBaseOperationOutcome theOperationOutcome) {
059                super(STATUS_CODE, theMessage, theOperationOutcome);
060        }
061
062
063}