~jaypipes/drizzle/split-xa-resource-manager

« back to all changes in this revision

Viewing changes to drizzled/error.h

  • Committer: Jay Pipes
  • Date: 2010-02-14 20:26:43 UTC
  • mfrom: (1273.1.27 staging)
  • Revision ID: jpipes@serialcoder-20100214202643-ahuqvc8rhn8u7y33
Merge trunk and resolve conflicts

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
24
 
25
25
namespace drizzled
26
26
{
27
27
 
 
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 */
 
34
 
 
35
typedef void (*error_handler_func)(uint32_t my_err,
 
36
                                   const char *str,
 
37
                                   myf MyFlags);
 
38
extern error_handler_func error_handler_hook;
 
39
 
28
40
bool init_errmessage(void);
29
41
const char * error_message(unsigned int err_index);
30
42
 
31
43
enum drizzled_error_code {
 
44
 
 
45
  EE_ERROR_FIRST=1,
 
46
  EE_CANTCREATEFILE,
 
47
  EE_READ,
 
48
  EE_WRITE,
 
49
  EE_BADCLOSE,
 
50
  EE_OUTOFMEMORY,
 
51
  EE_DELETE,
 
52
  EE_LINK,
 
53
  EE_EOFERR,
 
54
  EE_CANTLOCK,
 
55
  EE_CANTUNLOCK,
 
56
  EE_DIR,
 
57
  EE_STAT,
 
58
  EE_CANT_CHSIZE,
 
59
  EE_CANT_OPEN_STREAM,
 
60
  EE_GETWD,
 
61
  EE_SETWD,
 
62
  EE_LINK_WARNING,
 
63
  EE_OPEN_WARNING,
 
64
  EE_DISK_FULL,
 
65
  EE_CANT_MKDIR,
 
66
  EE_UNKNOWN_CHARSET,
 
67
  EE_OUT_OF_FILERESOURCES,
 
68
  EE_CANT_READLINK,
 
69
  EE_CANT_SYMLINK,
 
70
  EE_REALPATH,
 
71
  EE_SYNC,
 
72
  EE_UNKNOWN_COLLATION,
 
73
  EE_FILENOTFOUND,
 
74
  EE_FILE_NOT_CLOSED,
 
75
  EE_ERROR_LAST= EE_FILE_NOT_CLOSED,
 
76
 
32
77
  ER_ERROR_FIRST= 1000,
33
78
  ER_UNUSED1000= ER_ERROR_FIRST,
34
79
  ER_UNUSED1001,
723
768
  ER_INVALID_TIME_VALUE,
724
769
  ER_INVALID_ENUM_VALUE,
725
770
  ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE,
726
 
  ER_ERROR_LAST= ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE
727
 
};
 
771
  ER_CORRUPT_TABLE_DEFINITION,
 
772
  ER_ERROR_LAST= ER_CORRUPT_TABLE_DEFINITION
 
773
};
 
774
 
 
775
enum drizzle_exit_codes {
 
776
  EXIT_UNSPECIFIED_ERROR = 1,
 
777
  EXIT_UNKNOWN_OPTION,
 
778
  EXIT_AMBIGUOUS_OPTION,
 
779
  EXIT_NO_ARGUMENT_ALLOWED,
 
780
  EXIT_ARGUMENT_REQUIRED,
 
781
  EXIT_VAR_PREFIX_NOT_UNIQUE,
 
782
  EXIT_UNKNOWN_VARIABLE,
 
783
  EXIT_OUT_OF_MEMORY,
 
784
  EXIT_UNKNOWN_SUFFIX,
 
785
  EXIT_NO_PTR_TO_VARIABLE,
 
786
  EXIT_CANNOT_CONNECT_TO_SERVICE,
 
787
  EXIT_OPTION_DISABLED,
 
788
  EXIT_ARGUMENT_INVALID
 
789
};
 
790
 
 
791
 
 
792
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
 
793
#define EE(X)    (globerrs[(X) - EE_ERROR_FIRST])
 
794
 
 
795
/* Error message numbers in global map */
 
796
extern const char * globerrs[GLOBERRS];
 
797
 
 
798
void init_glob_errs(void);
 
799
void my_error(int nr,myf MyFlags, ...);
 
800
void my_printf_error(uint32_t my_err, const char *format,
 
801
                     myf MyFlags, ...)
 
802
                     __attribute__((format(printf, 2, 4)));
 
803
int my_error_register(const char **errmsgs, int first, int last);
 
804
void my_error_unregister_all(void);
 
805
const char **my_error_unregister(int first, int last);
 
806
void my_message(uint32_t my_err, const char *str,myf MyFlags);
 
807
void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags);
728
808
 
729
809
} /* namespace drizzled */
730
810