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

Go to the SVN repository for this file.

1 /* $Id: blast_exception.hpp 84663 2018-11-27 18:22:00Z ucko $
2  * ===========================================================================
3  *
4  * public DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Christiam Camacho
27  *
28  */
29 
30 /// @file blast_exception.hpp
31 /// Declares the BLAST exception class.
32 
33 #ifndef ALGO_BLAST_API___BLAST_EXCEPTION__HPP
34 #define ALGO_BLAST_API___BLAST_EXCEPTION__HPP
35 
36 #include <corelib/ncbiexpt.hpp>
37 
38 /** @addtogroup AlgoBlast
39  *
40  * @{
41  */
42 
44 BEGIN_SCOPE(blast)
45 
46 /// Defines system exceptions occurred while running BLAST
48 {
49 public:
50  /// Error types that BLAST can generate
51  enum EErrCode {
52  eOutOfMemory, ///< Out-of-memory
53  eNetworkError ///< Network error
54  };
55 
56  /// Translate from the error code value to its string representation
57  virtual const char* GetErrCodeString(void) const override {
58  switch ( GetErrCode() ) {
59  case eOutOfMemory: return "eOutOfMemory";
60  default: return CException::GetErrCodeString();
61  }
62  }
63 
64 #ifndef SKIP_DOXYGEN_PROCESSING
66 #endif /* SKIP_DOXYGEN_PROCESSING */
67 };
68 
69 /// Defines BLAST error codes (user errors included)
71 {
72 public:
73  /// Error types that BLAST can generate
74  enum EErrCode {
75  eCoreBlastError, ///< FIXME: need to interpret CORE errors
76  eInvalidOptions, ///< Invalid algorithm options
77  eInvalidArgument, ///< Invalid argument to some function/method
78  /// (could be programmer error - prefer assertions
79  /// in those cases unless API needs to be
80  /// "bullet-proof")
81  eNotSupported, ///< Feature not supported
82  eInvalidCharacter, ///< Invalid character in sequence data
83  eSeqSrcInit, ///< Initialization error in BlastSeqSrc
84  /// implementation
85  eRpsInit, ///< Error while initializing RPS-BLAST
86  eSetup ///< Error while setting up BLAST
87  };
88 
89  /// Translate from the error code value to its string representation
90  virtual const char* GetErrCodeString(void) const override {
91  switch ( GetErrCode() ) {
92  case eCoreBlastError: return "eCoreBlastError";
93  case eInvalidOptions: return "eInvalidOptions";
94  case eInvalidArgument: return "eInvalidArgument";
95  case eNotSupported: return "eNotSupported";
96  case eInvalidCharacter: return "eInvalidCharacter";
97  case eSeqSrcInit: return "eSeqSrcInit";
98  case eRpsInit: return "eRpsInit";
99  default: return CException::GetErrCodeString();
100  }
101  }
102 
103 #ifndef SKIP_DOXYGEN_PROCESSING
105 #endif /* SKIP_DOXYGEN_PROCESSING */
106 };
107 
108 END_SCOPE(blast)
110 
111 /* @} */
112 
113 #endif /* ALGO_BLAST_API___BLAST_EXCEPTION__HPP */
Defines BLAST error codes (user errors included)
Defines system exceptions occurred while running BLAST.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
EErrCode
Error types that BLAST can generate.
EErrCode
Error types that BLAST can generate.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
NCBI_EXCEPTION_DEFAULT(CBlastSystemException, CException)
NCBI_EXCEPTION_DEFAULT(CBlastException, CException)
@ eRpsInit
Error while initializing RPS-BLAST.
@ eSetup
Error while setting up BLAST.
@ eInvalidOptions
Invalid algorithm options.
@ eInvalidCharacter
Invalid character in sequence data.
@ eCoreBlastError
FIXME: need to interpret CORE errors.
@ eNotSupported
Feature not supported.
@ eSeqSrcInit
Initialization error in BlastSeqSrc implementation.
@ eInvalidArgument
Invalid argument to some function/method (could be programmer error - prefer assertions in those case...
@ eOutOfMemory
Out-of-memory.
TErrCode GetErrCode(void) const
Get error code.
Definition: ncbiexpt.cpp:453
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
Definition: ncbiexpt.cpp:444
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Defines NCBI C++ exception handling.
@ eNetworkError
Modified on Fri Dec 01 04:47:42 2023 by modify_doxy.py rev. 669887