/*!
  @header BDBExceptions
  @abstract Contains all exceptions thrown by BDB
 
  @availability OS X, GNUstep
  @copyright (C) 2004, 2005, 2006 Oliver Langer
 
  Author: Oliver Langer

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  11.12.2004 ola     initial version
  22.08.2006 ola     license changed
  -------------------------------------------------------------------------
  </pre>
 */

#if !defined(__BDBEXCEPTIONS_H)
#define __BDBEXCEPTIONS_H

#include <Encore/Encore.h>

/*!
 * @class BDBException
 * @abstract base exception class
 */
@interface BDBException : ECException {
  int errorCode;
}


/*!
 * @method raiseWithErrorCode
 * @abstract raises this exception
 * @param anErrorCode db error code
 */
- initWithErrorCode: (int) anErrorCode;


/*!
 * @method errorCode
 * @result underlying db error code.
 */
- (int) errorCode;


/*!
 * @method setErrorCode
 * @abstract specify the underlying error code
 * @param anErrorCode a db error code
 */
- setErrorCode: (int) anErrorCode;
@end


/*!
 * @class BDBDeadLockException
 * @abstract Thrown in case of a deadlock
 * @description DB error code: DB_LOCK_DEADLOCK
 */
@interface BDBDeadLockException : BDBException
@end


/*!
 * @class BDBLockNotGrantedException
 * @abstract thrown in case of a timeout while trying to gain lock
 * @discussion DB error code: DB_LOCK_NOTGRANTED
 */
@interface BDBLockNotGrantedException : BDBException
@end


/*!
 * @class BDBIllegalIndexReference
 * @abstract Thrown if a reference to a non existent index is being made
 * @discussion DB error code: DB_SECONDARY_BAD
 */
@interface BDBIllegalIndexReference : BDBException
@end


/*!
 * @class BDBNoValueForKeyException
 * @abstract The key exists but there is no data associated with it.
 *   the key may have been deleted before
 * @discussion DB error code: DB_KEYEMPTY
 */
@interface BDBNoValueForKeyException : BDBException
@end


/*!
 * @class BDBNotImplementedException
 * @abstract thrown if an empty method body has been called or a functionality
 *   is not been implemented yet.
 */
@interface BDBNotImplementedException : BDBException
@end


/*!
 * @class BDBInvalidDatabaseHandle
 * @abstract thrown if the database handle is not valid (any more)
 * @discussion eg. in case of the DB error: DB_REP_HANDLE_DEAD
 */
@interface BDBInvalidDatabaseHandle : BDBException
@end


/*!
 * @class BDBBtreeMaximumDepthReachedException
 * @abstract thrown if the maximum depth of a btree has been reached.
 */
@interface BDBBtreeMaximumDepthReachedException : BDBException
@end
#endif


