1 /* 2 * #%L 3 * DuplicateKeyException.java - mongodb-async-driver - Allanbank Consulting, Inc. 4 * %% 5 * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc. 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 package com.allanbank.mongodb.error; 21 22 import com.allanbank.mongodb.client.Message; 23 import com.allanbank.mongodb.client.message.Reply; 24 25 /** 26 * Exception raised when an insert encounters a duplicate key error. 27 * 28 * @api.yes This class is part of the driver's API. Public and protected members 29 * will be deprecated for at least 1 non-bugfix release (version 30 * numbers are <major>.<minor>.<bugfix>) before being 31 * removed or modified. 32 * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved 33 */ 34 public class DuplicateKeyException extends ReplyException { 35 36 /** The serialization version for the class. */ 37 private static final long serialVersionUID = -3588171889388956082L; 38 39 /** 40 * Create a new DuplicateKeyException. 41 * 42 * @param okValue 43 * The value of the "ok" field in the reply document. 44 * @param errorNumber 45 * The value of the "errNo" field in the reply document. 46 * @param errorMessage 47 * The value of the 'errmsg" field in the reply document. 48 * @param message 49 * The message that triggered the message. 50 * @param reply 51 * The reply with the error. 52 */ 53 public DuplicateKeyException(final int okValue, final int errorNumber, 54 final String errorMessage, final Message message, final Reply reply) { 55 super(okValue, errorNumber, errorMessage, message, reply); 56 } 57 58 /** 59 * Create a new DuplicateKeyException. 60 * 61 * @param okValue 62 * The value of the "ok" field in the reply document. 63 * @param errorNumber 64 * The value of the "errNo" field in the reply document. 65 * @param errorMessage 66 * The value of the 'errmsg" field in the reply document. 67 * @param reply 68 * The reply with the error. 69 */ 70 public DuplicateKeyException(final int okValue, final int errorNumber, 71 final String errorMessage, final Reply reply) { 72 this(okValue, errorNumber, errorMessage, null, reply); 73 } 74 75 }