View Javadoc
1   /*
2    * #%L
3    * MongoDbException.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;
21  
22  /**
23   * Exception base class for all MongoDB exceptions.
24   * 
25   * @api.yes This class is part of the driver's API. Public and protected members
26   *          will be deprecated for at least 1 non-bugfix release (version
27   *          numbers are <major>.<minor>.<bugfix>) before being
28   *          removed or modified.
29   * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved
30   */
31  public class MongoDbException extends RuntimeException {
32  
33      /** Serialization version for the class. */
34      private static final long serialVersionUID = 8065038814148830471L;
35  
36      /**
37       * Creates a new MongoDbException.
38       */
39      public MongoDbException() {
40          super();
41      }
42  
43      /**
44       * Creates a new MongoDbException.
45       * 
46       * @param message
47       *            Reason for the exception.
48       */
49      public MongoDbException(final String message) {
50          super(message);
51      }
52  
53      /**
54       * Creates a new MongoDbException.
55       * 
56       * @param message
57       *            Reason for the exception.
58       * @param cause
59       *            The exception causing the MongoDbException.
60       */
61      public MongoDbException(final String message, final Throwable cause) {
62          super(message, cause);
63      }
64  
65      /**
66       * Creates a new MongoDbException.
67       * 
68       * @param cause
69       *            The exception causing the MongoDbException.
70       */
71      public MongoDbException(final Throwable cause) {
72          super((cause == null) ? "" : cause.getMessage(), cause);
73      }
74  
75  }