1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_MY_ERROR_H
21
#define DRIZZLED_MY_ERROR_H
23
#include "drizzled/definitions.h"
28
/* Max width of screen (for error messages) */
29
#define SC_MAXWIDTH 256
30
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
31
#define NRERRBUFFS (2) /* Buffers for parameters */
32
#define MY_FILE_ERROR ((size_t) -1)
33
#define ME_FATALERROR 1024 /* Fatal statement error */
35
typedef void (*error_handler_func)(uint32_t my_err, const char *str,myf MyFlags);
36
extern error_handler_func error_handler_hook;
39
Do not add error numbers before EE_ERROR_FIRST.
40
If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
42
We start with error 1 to not confuse peoples with 'error 0'
45
#define EE_ERROR_FIRST 1 /*Copy first error nr.*/
46
#define EE_CANTCREATEFILE 1
50
#define EE_OUTOFMEMORY 5
54
#define EE_CANTLOCK 10
55
#define EE_CANTUNLOCK 11
58
#define EE_CANT_CHSIZE 14
59
#define EE_CANT_OPEN_STREAM 15
62
#define EE_LINK_WARNING 18
63
#define EE_OPEN_WARNING 19
64
#define EE_DISK_FULL 20
65
#define EE_CANT_MKDIR 21
66
#define EE_UNKNOWN_CHARSET 22
67
#define EE_OUT_OF_FILERESOURCES 23
68
#define EE_CANT_READLINK 24
69
#define EE_CANT_SYMLINK 25
70
#define EE_REALPATH 26
72
#define EE_UNKNOWN_COLLATION 28
73
#define EE_FILENOTFOUND 29
74
#define EE_FILE_NOT_CLOSED 30
75
#define EE_ERROR_LAST 30 /* Copy last error nr */
76
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
78
/* exit codes for all MySQL programs */
80
#define EXIT_UNSPECIFIED_ERROR 1
81
#define EXIT_UNKNOWN_OPTION 2
82
#define EXIT_AMBIGUOUS_OPTION 3
83
#define EXIT_NO_ARGUMENT_ALLOWED 4
84
#define EXIT_ARGUMENT_REQUIRED 5
85
#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
86
#define EXIT_UNKNOWN_VARIABLE 7
87
#define EXIT_OUT_OF_MEMORY 8
88
#define EXIT_UNKNOWN_SUFFIX 9
89
#define EXIT_NO_PTR_TO_VARIABLE 10
90
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
91
#define EXIT_OPTION_DISABLED 12
92
#define EXIT_ARGUMENT_INVALID 13
94
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
95
#define EE(X) (globerrs[(X) - EE_ERROR_FIRST])
97
/* Error message numbers in global map */
98
extern const char * globerrs[GLOBERRS];
100
void init_glob_errs(void);
101
void my_error(int nr,myf MyFlags, ...);
102
void my_printf_error(uint32_t my_err, const char *format,
104
__attribute__((format(printf, 2, 4)));
105
int my_error_register(const char **errmsgs, int first, int last);
106
void my_error_unregister_all(void);
107
const char **my_error_unregister(int first, int last);
108
void my_message(uint32_t my_err, const char *str,myf MyFlags);
109
void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags);
111
} /* namespace drizzled */
113
#endif /* DRIZZLED_MY_ERROR_H */