001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.petstore.service;
018
019import static org.apache.juneau.commons.utils.Shorts.*;
020
021/**
022 * Thrown when a petstore operation conflicts with the entity's current state (HTTP 409 at the console layer).
023 *
024 * <h5 class='section'>Example:</h5>
025 * <p class='bjava'>
026 *    <jk>if</jk> (<jv>pet</jv>.getStatus() == PetStatus.<jsf>SOLD</jsf>)
027 *       <jk>throw new</jk> PetstoreConflictException(<js>"Pet '%s' is already '%s'"</js>, <jv>pet</jv>.getId(), <jv>pet</jv>.getStatus());
028 * </p>
029 */
030public class PetstoreConflictException extends RuntimeException {
031
032   private static final long serialVersionUID = 1L;
033
034   /**
035    * Constructor.
036    *
037    * @param message The message, a {@link String#format} pattern with {@code '%s'} placeholders.
038    * @param args The message arguments.
039    */
040   public PetstoreConflictException(String message, Object...args) {
041      super(f(message, args));
042   }
043}