Patchwork [05/22] qerror: add new error message for invalid enum values

login
register
mail settings
Submitter Anthony Liguori
Date March 7, 2011, 1:22 a.m.
Message ID <1299460984-15849-6-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/85641/
State New
Headers show

Comments

Anthony Liguori - March 7, 2011, 1:22 a.m.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Patch

diff --git a/qerror.c b/qerror.c
index 78d3884..5a1e637 100644
--- a/qerror.c
+++ b/qerror.c
@@ -109,6 +109,10 @@  static const QErrorStringTable qerror_table[] = {
         .desc      = "Duplicate ID '%(id)' for %(object)",
     },
     {
+        .error_fmt = QERR_ENUM_VALUE_INVALID,
+        .desc      = "Enum value '%(value)' is invalid for type '%(type)'",
+    },
+    {
         .error_fmt = QERR_FD_NOT_FOUND,
         .desc      = "File descriptor named '%(name)' not found",
     },
diff --git a/qerror.h b/qerror.h
index 495d0a4..35e7253 100644
--- a/qerror.h
+++ b/qerror.h
@@ -98,6 +98,9 @@  void qerror_set_desc(QError *qerr, const char *fmt);
 #define QERR_DUPLICATE_ID \
     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
 
+#define QERR_ENUM_VALUE_INVALID \
+    "{ 'class': 'EnumValueInvalid', 'data': { 'type': %s, 'value': %s } }"
+
 #define QERR_FD_NOT_FOUND \
     "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"