Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

DatabaseException.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1997-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: DatabaseException.java,v 12.1 2005/06/16 20:22:59 bostic Exp $
00008  */
00009 package com.sleepycat.db;
00010 
00011 import com.sleepycat.db.internal.DbEnv;
00012 
00013 public class DatabaseException extends Exception {
00014     private Environment dbenv;
00015     private int errno;
00016 
00017     public DatabaseException(final String s) {
00018         this(s, 0, (Environment)null);
00019     }
00020 
00021     public DatabaseException(final String s, final int errno) {
00022         this(s, errno, (Environment)null);
00023     }
00024 
00025     public DatabaseException(final String s,
00026                              final int errno,
00027                              final Environment dbenv) {
00028         super(s);
00029         this.errno = errno;
00030         this.dbenv = dbenv;
00031     }
00032 
00033     protected DatabaseException(final String s,
00034                                 final int errno,
00035                                 final DbEnv dbenv) {
00036         this(s, errno, (dbenv == null) ? null : dbenv.wrapper);
00037     }
00038 
00039     public Environment getEnvironment() {
00040         return dbenv;
00041     }
00042 
00043     public int getErrno() {
00044         return errno;
00045     }
00046 
00047     public String toString() {
00048         String s = super.toString();
00049         if (errno != 0)
00050             s += ": " + DbEnv.strerror(errno);
00051         return s;
00052     }
00053 }

Generated on Sun Dec 25 12:14:32 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2