MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NDBT_Error.hpp
1 /*
2  Copyright (C) 2003, 2005-2007 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef NDBT_Error_HPP
20 #define NDBT_Error_HPP
21 
22 #include <NdbOut.hpp>
23 #include <NdbError.hpp>
24 
30 class ErrorData {
31 
32 public:
33  ErrorData();
34  ~ErrorData();
35 
41  bool parseCmdLineArg(const char ** argv, int & i);
42 
46  void printCmdLineArgs(NdbOut & out = ndbout);
47 
51  void printSettings(NdbOut & out = ndbout);
52 
56  void printErrorCounters(NdbOut & out = ndbout) const;
57 
61  void resetErrorCounters();
62 
66  int handleErrorCommon(const NdbError & error);
67 
68 private:
69  bool key_error;
70  bool temporary_resource_error;
71  bool insufficient_space_error;
72  bool node_recovery_error;
73  bool overload_error;
74  bool timeout_error;
75  bool internal_error;
76  bool user_error;
77  bool application_error;
78 
79  Uint32 * errorCountArray;
80 };
81 
82 //
83 // ERR prints an NdbError object together with a description of where the
84 // error occured
85 //
86 #define ERR_OUT(where, error) \
87  { where << "ERROR: " << error.code << " " \
88  << error.message << endl \
89  << " " << "Status: " << error.status \
90  << ", Classification: " << error.classification << endl\
91  << " " << "File: " << __FILE__ \
92  << " (Line: " << __LINE__ << ")" << endl \
93  ; \
94  }
95 
96 #define ERR(error) \
97 { \
98  const NdbError &_error= (error); \
99  ERR_OUT(g_err, _error); \
100 }
101 #define ERR_INFO(error) ERR_OUT(g_info, error)
102 
103 #endif