1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 1997,2008 Oracle. All rights reserved. 5 * 6 * $Id: ErrorHandler.java,v 12.7 2008/01/17 05:04:53 mjc Exp $ 7 */ 8package com.sleepycat.db; 9 10/** 11An interface specifying a callback function to be called when an error 12occurs in the Berkeley DB library. 13*/ 14public interface ErrorHandler { 15 /** 16 A callback function to be called when an error occurs in the 17 Berkeley DB library. 18 <p> 19 When an error occurs in the Berkeley DB library, an exception is 20 thrown. In some cases, however, the exception may be insufficient 21 to completely describe the cause of the error, especially during 22 initial application debugging. 23 <p> 24 The {@link com.sleepycat.db.EnvironmentConfig#setErrorHandler EnvironmentConfig.setErrorHandler} and 25 {@link com.sleepycat.db.DatabaseConfig#setErrorHandler DatabaseConfig.setErrorHandler} methods are used to enhance 26 the mechanism for reporting error messages to the application. In 27 some cases, when an error occurs, Berkeley DB will invoke the 28 ErrorHandler's object error method. It is up to this method to 29 display the error message in an appropriate manner. <p> 30 @param environment 31 The enclosing database environment handle. 32 <p> 33 @param errpfx 34 The prefix string, as previously configured by 35 {@link com.sleepycat.db.EnvironmentConfig#setErrorPrefix EnvironmentConfig.setErrorPrefix} or 36 {@link com.sleepycat.db.DatabaseConfig#setErrorPrefix DatabaseConfig.setErrorPrefix}. 37 <p> 38 @param msg 39 An error message string. 40 */ 41 void error(Environment environment, String errpfx, String msg); 42} 43