diff mbox

[04/15] QError: Add errors used by QMP

Message ID 1258643623-8636-5-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino Nov. 19, 2009, 3:13 p.m. UTC
NOTE: These errors where added quickly to satisfy immediate needs,
they need to be reviewed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qerror.c |   20 ++++++++++++++++++++
 qerror.h |   15 +++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/qerror.c b/qerror.c
index d8b125e..4349417 100644
--- a/qerror.c
+++ b/qerror.c
@@ -52,6 +52,26 @@  const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_KVM_MISSING_CAP,
         .desc      = "Using KVM without %(capability), %(feature) unavailable",
     },
+    {
+        .error_fmt   = QERR_BAD_SYNTAX,
+        .desc        = "wrong syntax: '%(reason)",
+    },
+    {
+        .error_fmt   = QERR_COMMAND_NOT_FOUND,
+        .desc        = "command: %(name)",
+    },
+    {
+        .error_fmt   = QERR_COMMAND_NOT_ISSUED,
+        .desc        = "a command should be issued",
+    },
+    {
+        .error_fmt   = QERR_INVALID_PARAMETER,
+        .desc        = "invalid parameter '%(parameter)': %(reason)",
+    },
+    {
+        .error_fmt   = QERR_UNDEFINED_ERROR,
+        .desc        = "an error has ocurred: %(hint)",
+    },
     {}
 };
 
diff --git a/qerror.h b/qerror.h
index 6c100af..1b704e4 100644
--- a/qerror.h
+++ b/qerror.h
@@ -47,4 +47,19 @@  QError *qobject_to_qerror(const QObject *obj);
 #define QERR_KVM_MISSING_CAP \
         "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
 
+#define QERR_BAD_SYNTAX \
+        "{ 'class': 'BadSyntax', 'data': { 'reason': %s } }"
+
+#define QERR_COMMAND_NOT_FOUND \
+        "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
+
+#define QERR_COMMAND_NOT_ISSUED \
+        "{ 'class': 'CommandNotIssued', 'data': { } }"
+
+#define QERR_INVALID_PARAMETER \
+        "{ 'class': 'InvalidParameter', 'data': { 'parameter': %s, 'reason': %s } }"
+
+#define QERR_UNDEFINED_ERROR \
+        "{ 'class': 'UndefinedError', 'data': { 'hint': %s } }"
+
 #endif /* QERROR_H */