Xmipp  v3.23.11-Nereus
xmipp_error.h
Go to the documentation of this file.
1 /***************************************************************************
2 *
3 * Authors: Carlos Oscar S. Sorzano (coss@cnb.csic.es)
4 *
5 * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307 USA
21 *
22 * All comments concerning this program package may be sent to the
23 * e-mail address 'xmipp@cnb.csic.es'
24 ***************************************************************************/
25 
26 #pragma once
27 
28 #include <stdexcept>
29 #include "xmipp_strings.h"
30 
95 /* Enum with errors types.
96  * This enum represent the code of all possible
97  * Xmipp erros that will be used to reporting errors
98  * with REPORT_ERROR and EXIT_ERROR.
99  * The convention for the codes is the following:
100  * - All starts with prefix ERR_
101  * - Follows some kind of section. Like IO for input/output errors.
102  * ERR_IO_
103  * ERR_MEM_
104  * ERR_IMG_
105  * - Finally an abbreviation for the error msg.
106  * All error codes have a default string message
107  * that can be obtained with XmippError::getDefaultMessage(ErrorType)
108  */
110 {
116 
118 
121 
123 
127 
131 
133 
146 
148 
153 
164 
169 
172 
176 
178 
180 
183 
185 
187 
189 
191 
193 
197 
199 };
200 
201 
211 #define REPORT_ERROR(nerr, ErrormMsg) throw XmippError(nerr, ErrormMsg, __FILE__, __LINE__)
212 
213 //#define REPORT_ERROR(nerr) throw XmippError((ErrorType)nerr, "", __FILE__, __LINE__)
214 
221 class XmippError : public std::runtime_error
222 {
223 public:
224  XmippError(const ErrorType nerr, const String& what,
225  const String &fileArg, const long lineArg);
226 
227  XmippError(const std::string &what):XmippError(ERR_UNCLASSIFIED,what,"Unknown file",0) {};
228 
230 private:
231  static String getMessage(const ErrorType nerr, const String& what,
232  const String &fileArg, const long lineArg);
233 
235  static String getDefaultMessage(ErrorType e);
236 };
237 
240 void reportWarning(const String& what);
241 
242 /* @} */
Argument missing.
Definition: xmipp_error.h:114
Index out of bounds.
Definition: xmipp_error.h:132
Just to locate unclassified errors.
Definition: xmipp_error.h:192
Grid general error.
Definition: xmipp_error.h:125
No active object in MetaData.
Definition: xmipp_error.h:155
Errors on command line parameters.
Definition: xmipp_error.h:112
Empty value.
Definition: xmipp_error.h:194
Parameter incorrect.
Definition: xmipp_error.h:181
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
void reportWarning(const String &what)
MultidimArray is empty.
Definition: xmipp_error.h:175
Just an error for debugging purpose.
Definition: xmipp_error.h:119
Error with some arguments dependencies.
Definition: xmipp_error.h:115
Problem with matrix size.
Definition: xmipp_error.h:152
Global mmap error.
Definition: xmipp_error.h:170
No exist requested object.
Definition: xmipp_error.h:156
Just for debugging, situation that can&#39;t happens.
Definition: xmipp_error.h:120
Matrix error.
Definition: xmipp_error.h:149
Couldn&#39;t write to file.
Definition: xmipp_error.h:140
It is not a directory.
Definition: xmipp_error.h:142
Null pointer passed as parameter.
Definition: xmipp_error.h:168
There is not enough memory for allocation.
Definition: xmipp_error.h:166
The matrix is empty.
Definition: xmipp_error.h:151
Unexpected label.
Definition: xmipp_error.h:157
Unknown image type.
Definition: xmipp_error.h:130
Input/Output general error.
Definition: xmipp_error.h:134
Cannot read image from file.
Definition: xmipp_error.h:128
Incorrect MultidimArray size.
Definition: xmipp_error.h:174
XmippError(const ErrorType nerr, const String &what, const String &fileArg, const long lineArg)
Definition: xmipp_error.cpp:32
Memory has not been deallocated.
Definition: xmipp_error.h:167
ErrorType
Definition: xmipp_error.h:109
Cannot write image to file.
Definition: xmipp_error.h:129
Bad amount of memory requested.
Definition: xmipp_error.h:165
Incorrect number of objects in Metadata.
Definition: xmipp_error.h:160
XmippError(const std::string &what)
Definition: xmipp_error.h:227
Error in docfile format.
Definition: xmipp_error.h:186
File cannot be closed.
Definition: xmipp_error.h:135
Undefined label.
Definition: xmipp_error.h:162
Error in SQL of MetaData operations.
Definition: xmipp_error.h:159
Map addressing of file has failed.
Definition: xmipp_error.h:171
It is not a file.
Definition: xmipp_error.h:141
Problem with matrix dimensions.
Definition: xmipp_error.h:150
Required function not implemented.
Definition: xmipp_error.h:117
GPU memory related issues.
Definition: xmipp_error.h:124
Incorrect argument received.
Definition: xmipp_error.h:113
Error related to numerical calculation.
Definition: xmipp_error.h:179
MetaData error.
Definition: xmipp_error.h:154
Missing expected label.
Definition: xmipp_error.h:158
File or directory does not exist.
Definition: xmipp_error.h:136
Couldn&#39;t read from file.
Definition: xmipp_error.h:139
This block does not exist.
Definition: xmipp_error.h:163
Threads cannot be initiated.
Definition: xmipp_error.h:188
FFT Plan cannot be created.
Definition: xmipp_error.h:184
File cannot be open.
Definition: xmipp_error.h:137
Bad label type.
Definition: xmipp_error.h:161
Value has not been set.
Definition: xmipp_error.h:196
Incorrect number of GRID volumes or shapes.
Definition: xmipp_error.h:126
Error in docfile format.
Definition: xmipp_error.h:122
std::string String
Definition: xmipp_strings.h:34
Error when locking/unloking a file.
Definition: xmipp_error.h:144
ErrorType __errno
Definition: xmipp_error.h:227
Environment PATH cannot be read.
Definition: xmipp_error.h:143
Incorrect MultidimArray dimensions.
Definition: xmipp_error.h:173
Incorrect file size.
Definition: xmipp_error.h:145
Incorrect type received.
Definition: xmipp_error.h:190
Insufficient permissions to perform operation.
Definition: xmipp_error.h:138
Incorrect value received.
Definition: xmipp_error.h:195
Parameter missing.
Definition: xmipp_error.h:182
Some logical error in the pipeline.
Definition: xmipp_error.h:147