NCBI C++ ToolKit
objmgr_exception.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: objmgr_exception.cpp 98733 2022-12-28 15:46:44Z vasilche $
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  * Authors: Eugene Vasilchenko
27  *
28  */
29 
30 /// @file objmgr_exception.cpp
31 /// Implementation of object manager exception classes.
32 ///
33 
34 
35 #include <ncbi_pch.hpp>
36 #include <corelib/ncbistd.hpp>
38 
41 
42 const char* CObjMgrException::GetErrCodeString(void) const
43 {
44  switch ( GetErrCode() ) {
45  case eNotImplemented: return "eNotImplemented";
46  case eRegisterError: return "eRegisterError";
47  case eFindConflict: return "eFindConflict";
48  case eFindFailed: return "eFindFailed";
49  case eAddDataError: return "eAddDataError";
50  case eModifyDataError: return "eModifyDataError";
51  case eInvalidHandle: return "eInvalidHandle";
52  case eLockedData: return "eLockedData";
53  case eTransaction: return "eTransaction";
54  case eMissingData: return "eMissingData";
55  case eOtherError: return "eOtherError";
56  default: return CException::GetErrCodeString();
57  }
58 }
59 
60 
61 const char* CSeqMapException::GetErrCodeString(void) const
62 {
63  switch ( GetErrCode() ) {
64  case eUnimplemented: return "eUnimplemented";
65  case eIteratorTooBig: return "eIteratorTooBig";
66  case eSegmentTypeError: return "eSegmentTypeError";
67  case eDataError: return "eSeqDataError";
68  case eOutOfRange: return "eOutOfRange";
69  case eInvalidIndex: return "eInvalidIndex";
70  case eNullPointer: return "eNullPointer";
71  case eFail: return "eFail";
72  case eSelfReference: return "eSelfReference";
73  default: return CException::GetErrCodeString();
74  }
75 }
76 
77 
79 {
80  switch ( GetErrCode() ) {
81  case eCodingError: return "eCodingError";
82  case eDataError: return "eSeqDataError";
83  case eOutOfRange: return "eOutOfRange";
84  default: return CException::GetErrCodeString();
85  }
86 }
87 
88 
89 const char* CAnnotException::GetErrCodeString(void) const
90 {
91  switch ( GetErrCode() ) {
92  case eBadLocation: return "eBadLocation";
93  case eFindFailed: return "eFindFailed";
94  case eLimitError: return "eLimitError";
95  case eOtherError: return "eOtherError";
96  case eIncomatibleType: return "eIncomatibleType";
97  default: return CException::GetErrCodeString();
98  }
99 }
100 
101 
102 const char* CLoaderException::GetErrCodeString(void) const
103 {
104  switch ( GetErrCode() ) {
105  case eNotImplemented: return "eNotImplemented";
106  case eNoData: return "eNoData";
107  case ePrivateData: return "ePrivateData";
108  case eConnectionFailed: return "eConnectionFailed";
109  case eCompressionError: return "eCompressionError";
110  case eLoaderFailed: return "eLoaderFailed";
111  case eNoConnection: return "eNoConnection";
112  case eOtherError: return "eOtherError";
113  case eRepeatAgain: return "eRepeatAgain";
114  case eBadConfig: return "eBadConfig";
115  case eNotFound: return "eNotFound";
116  default: return CException::GetErrCodeString();
117  }
118 }
119 
120 
121 void CLoaderException::SetFailedCall(const string& call)
122 {
123  m_FailedCall = call;
124 }
125 
126 
127 void CLoaderException::ReportExtra(ostream& out) const
128 {
129  if ( !m_FailedCall.empty() ) {
130  out << "in " << m_FailedCall;
131  }
132 }
133 
134 
136 {
137  switch ( GetErrCode() ) {
138  case eBlobStateError: return "eBlobStateError";
139  case eLoaderError: return "eLoaderError";
140  case eOtherError: return "eOtherError";
141  default: return CException::GetErrCodeString();
142  }
143 }
144 
145 
147 {
148  switch ( GetErrCode() ) {
149  case eNotImplemented: return "eNotImplemented";
150  case eBadSequenceType: return "eBadSequenceType";
151  case eBadLocation: return "eBadLocation";
152  case eNotUnique: return "eNotUnique";
153  case eUnknownLength: return "eUnknownLength";
154  case eBadResidue: return "eBadResidue";
155  case eBadFeature: return "eBadFeature";
156  case eBadAlignment: return "eBadAlignment";
157  default: return CException::GetErrCodeString();
158  }
159 }
160 
161 
163 {
164  switch ( GetErrCode() ) {
165  case eTimeLimitExceded: return "eTimeLimitExceded";
166  case eSegmentsLimitExceded: return "eSegmentsLimitExceded";
167  default: return CObjMgrException::GetErrCodeString();
168  }
169 }
170 
171 
Base class for all object manager exceptions.
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
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
TErrCode GetErrCode(void) const
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
void SetFailedCall(const string &call)
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual void ReportExtra(ostream &out) const override
Report "non-standard" attributes.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
@ eDataError
Sequence data error.
@ eOutOfRange
Attempt to access out-of-range iterator.
@ eCodingError
Incompatible coding selected.
@ eIncomatibleType
Incompatible annotation type (feat/graph/align)
@ eFindFailed
Seq-id can not be resolved.
@ eLimitError
Invalid or unknown limit object.
@ eBadLocation
Wrong location type while mapping annotations.
@ eUnimplemented
The method is not implemented.
@ eSegmentTypeError
Wrong segment type.
@ eIteratorTooBig
Bad internal iterator in delta map.
@ eInvalidIndex
Invalid segment index.
@ eSelfReference
Self-reference in seq map is detected.
@ eNullPointer
Attempt to access non-existing object.
@ eFail
Operation failed.
@ eOutOfRange
Iterator is out of range.
@ eDataError
SeqMap data error.
#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
#define const
Definition: zconf.h:232
Modified on Sun May 12 04:54:04 2024 by modify_doxy.py rev. 669887