~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/error.h

  • Committer: Tim Penhey
  • Date: 2010-01-22 01:44:35 UTC
  • mto: (1271.7.10)
  • mto: This revision was merged to the branch mainline in revision 1293.
  • Revision ID: tim@penhey.net-20100122014435-siqx681pldi6u1vn
Move the bits from my_error.h and my_error.cc into error.h and error.cc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_ERROR_H
21
21
#define DRIZZLED_ERROR_H
22
22
 
23
 
#include "drizzled/my_error.h"
 
23
#include "drizzled/definitions.h"
 
24
 
 
25
/* Max width of screen (for error messages) */
 
26
#define SC_MAXWIDTH 256
 
27
#define ERRMSGSIZE      (SC_MAXWIDTH)   /* Max length of a error message */
 
28
#define NRERRBUFFS      (2)     /* Buffers for parameters */
 
29
#define MY_FILE_ERROR   ((size_t) -1)
 
30
#define ME_FATALERROR   1024    /* Fatal statement error */
 
31
 
 
32
typedef void (*error_handler_func)(uint32_t my_err, const char *str,myf MyFlags);
 
33
extern error_handler_func error_handler_hook;
24
34
 
25
35
#ifdef  __cplusplus
26
36
extern "C" {
30
40
const char * error_message(unsigned int err_index);
31
41
 
32
42
enum drizzled_error_code {
 
43
 
 
44
  EE_ERROR_FIRST=1,
 
45
  EE_CANTCREATEFILE,
 
46
  EE_READ,
 
47
  EE_WRITE,
 
48
  EE_BADCLOSE,
 
49
  EE_OUTOFMEMORY,
 
50
  EE_DELETE,
 
51
  EE_LINK,
 
52
  EE_EOFERR,
 
53
  EE_CANTLOCK,
 
54
  EE_CANTUNLOCK,
 
55
  EE_DIR,
 
56
  EE_STAT,
 
57
  EE_CANT_CHSIZE,
 
58
  EE_CANT_OPEN_STREAM,
 
59
  EE_GETWD,
 
60
  EE_SETWD,
 
61
  EE_LINK_WARNING,
 
62
  EE_OPEN_WARNING,
 
63
  EE_DISK_FULL,
 
64
  EE_CANT_MKDIR,
 
65
  EE_UNKNOWN_CHARSET,
 
66
  EE_OUT_OF_FILERESOURCES,
 
67
  EE_CANT_READLINK,
 
68
  EE_CANT_SYMLINK,
 
69
  EE_REALPATH,
 
70
  EE_SYNC,
 
71
  EE_UNKNOWN_COLLATION,
 
72
  EE_FILENOTFOUND,
 
73
  EE_FILE_NOT_CLOSED,
 
74
  EE_ERROR_LAST= EE_FILE_NOT_CLOSED,
 
75
 
33
76
  ER_ERROR_FIRST= 1000,
34
77
  ER_UNUSED1000= ER_ERROR_FIRST,
35
78
  ER_UNUSED1001,
727
770
  ER_ERROR_LAST= ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE
728
771
};
729
772
 
 
773
enum drizzle_exit_codes {
 
774
  EXIT_UNSPECIFIED_ERROR = 1,
 
775
  EXIT_UNKNOWN_OPTION,
 
776
  EXIT_AMBIGUOUS_OPTION,
 
777
  EXIT_NO_ARGUMENT_ALLOWED,
 
778
  EXIT_ARGUMENT_REQUIRED,
 
779
  EXIT_VAR_PREFIX_NOT_UNIQUE,
 
780
  EXIT_UNKNOWN_VARIABLE,
 
781
  EXIT_OUT_OF_MEMORY,
 
782
  EXIT_UNKNOWN_SUFFIX,
 
783
  EXIT_NO_PTR_TO_VARIABLE,
 
784
  EXIT_CANNOT_CONNECT_TO_SERVICE,
 
785
  EXIT_OPTION_DISABLED,
 
786
  EXIT_ARGUMENT_INVALID
 
787
};
 
788
 
 
789
 
 
790
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
 
791
#define EE(X)    (globerrs[(X) - EE_ERROR_FIRST])
 
792
 
 
793
/* Error message numbers in global map */
 
794
extern const char * globerrs[GLOBERRS];
 
795
 
 
796
void init_glob_errs(void);
 
797
void my_error(int nr,myf MyFlags, ...);
 
798
void my_printf_error(uint32_t my_err, const char *format,
 
799
                     myf MyFlags, ...)
 
800
                     __attribute__((format(printf, 2, 4)));
 
801
int my_error_register(const char **errmsgs, int first, int last);
 
802
void my_error_unregister_all(void);
 
803
const char **my_error_unregister(int first, int last);
 
804
void my_message(uint32_t my_err, const char *str,myf MyFlags);
 
805
void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags);
 
806
 
730
807
#ifdef  __cplusplus
731
808
}
732
809
#endif