NCBI C++ ToolKit
err_handler.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef _ERROR_HANDLER_HPP_
2 #define _ERROR_HANDLER_HPP_
3 
4 /* $Id: err_handler.hpp 77792 2017-05-08 13:38:35Z ivanov $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * File Name: $Id: err_handler.hpp 77792 2017-05-08 13:38:35Z ivanov $
30 *
31 * Author: Michael Kholodov
32 *
33 * File Description: DataSource implementation
34 *
35 */
36 
37 #include <dbapi/dbapi.hpp>
38 
40 
42 {
43 public:
45  virtual ~CToMultiExHandler();
46 
47  // Return TRUE (i.e. always process the "ex").
48  virtual bool HandleIt(CDB_Exception* ex);
49  virtual bool HandleAll(const TExceptions& exceptions);
50 
52  return m_ex.get();
53  }
54 
55  void ReplaceMultiEx() {
56  m_ex.reset( new CDB_MultiEx(DIAG_COMPILE_INFO, 0) );
57  }
58 
59 private:
60  unique_ptr<CDB_MultiEx> m_ex;
61 };
62 
64 
65 #endif // _ARRAY_HPP_
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
Definition: err_handler.cpp:55
virtual ~CToMultiExHandler()
Definition: err_handler.cpp:43
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:169
deque< CDB_Exception * > TExceptions
Exception container type.
Definition: exception.hpp:554
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
Definition: err_handler.cpp:47
CDB_MultiEx * GetMultiEx()
Definition: err_handler.hpp:51
CDB_Exception –.
Definition: exception.hpp:116
Defines the database API innterfaces for a variety of DBMS.
unique_ptr< CDB_MultiEx > m_ex
Definition: err_handler.hpp:60
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
Modified on Wed May 24 16:17:20 2017 by modify_doxy.py rev. 533848