~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/error.h

  • Committer: Brian Aker
  • Date: 2010-12-26 00:07:57 UTC
  • Revision ID: brian@tangent.org-20101226000757-ysntnltqywxoe1em
MErge in the include changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <string>
24
24
#include <boost/unordered_map.hpp>
25
25
 
26
 
#include "drizzled/error_t.h"
27
26
#include "drizzled/definitions.h"
28
 
#include "drizzled/identifier.h"
29
27
 
30
28
namespace drizzled
31
29
{
44
42
{
45
43
public:
46
44
  typedef std::pair<std::string, std::string> value_type;
47
 
  typedef boost::unordered_map<drizzled::error_t, value_type> ErrorMessageMap;
 
45
  typedef boost::unordered_map<uint32_t, value_type> ErrorMessageMap;
48
46
 
49
47
  ErrorMap();
50
48
 
51
49
  // Insert the message for the error.  If the error already has an existing
52
50
  // mapping, an error is logged, but the function continues.
53
 
  void add(drizzled::error_t error_num, const std::string &error_name, const std::string &message);
 
51
  void add(uint32_t error_num, const std::string &error_name, const std::string &message);
54
52
 
55
53
  // If there is no error mapping for the error_num, ErrorStringNotFound is raised.
56
 
  const std::string &find(drizzled::error_t error_num) const;
 
54
  const std::string &find(uint32_t error_num) const;
57
55
 
58
56
  static const ErrorMessageMap& get_error_message_map();
59
57
private:
65
63
};
66
64
 
67
65
 
68
 
typedef void (*error_handler_func)(drizzled::error_t my_err,
 
66
typedef void (*error_handler_func)(uint32_t my_err,
69
67
                                   const char *str,
70
68
                                   myf MyFlags);
71
69
extern error_handler_func error_handler_hook;
72
70
 
73
71
// TODO: kill this method. Too much to do with this branch.
74
72
// This is called through the ER(x) macro.
75
 
const char * error_message(drizzled::error_t err_index);
 
73
const char * error_message(unsigned int err_index);
76
74
 
77
75
// Adds the message to the global error dictionary.
78
 
void add_error_message(drizzled::error_t error_code, const std::string &error_name,
 
76
void add_error_message(uint32_t error_code, const std::string &error_name,
79
77
                       const std::string& message);
80
78
#define DRIZZLE_ADD_ERROR_MESSAGE(code, msg) add_error_message(code, STRINGIFY_ARG(code), msg)
81
79
 
82
 
void my_error(error_t nr, drizzled::Identifier::const_reference ref, myf MyFlags= MYF(0));
83
 
void my_error(error_t nr);
84
 
void my_error(error_t nr, myf MyFlags, ...);
85
 
void my_message(drizzled::error_t my_err, const char *str, myf MyFlags);
86
 
void my_printf_error(drizzled::error_t my_err, const char *format,
 
80
void my_error(int nr, myf MyFlags, ...);
 
81
void my_message(uint32_t my_err, const char *str, myf MyFlags);
 
82
void my_printf_error(uint32_t my_err, const char *format,
87
83
                     myf MyFlags, ...)
88
84
                     __attribute__((format(printf, 2, 4)));
89
85