Patchwork [v7,1/4] qerror: add five qerror strings

login
register
mail settings
Submitter Amos Kong
Date April 19, 2012, 7:11 a.m.
Message ID <20120419071125.26838.50423.stgit@dhcp-8-167.nay.redhat.com>
Download mbox | patch
Permalink /patch/153661/
State New
Headers show

Comments

Amos Kong - April 19, 2012, 7:11 a.m.
Add five new qerror strings, they are about listen/connect socket:
  QERR_SOCKET_CONNECT_IN_PROGRESS
  QERR_SOCKET_CONNECT_FAILED
  QERR_SOCKET_LISTEN_FAILED
  QERR_SOCKET_BIND_FAILED
  QERR_SOCKET_CREATE_FAILED

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qerror.c |   20 ++++++++++++++++++++
 qerror.h |   15 +++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
Michael Roth - April 20, 2012, 1:20 a.m.
On Thu, Apr 19, 2012 at 03:11:25PM +0800, Amos Kong wrote:
> Add five new qerror strings, they are about listen/connect socket:
>   QERR_SOCKET_CONNECT_IN_PROGRESS
>   QERR_SOCKET_CONNECT_FAILED
>   QERR_SOCKET_LISTEN_FAILED
>   QERR_SOCKET_BIND_FAILED
>   QERR_SOCKET_CREATE_FAILED
> 
> Signed-off-by: Amos Kong <akong@redhat.com>

I had some comments on the last series regarding the wording of the error
messages that aren't addressed here.

> ---
>  qerror.c |   20 ++++++++++++++++++++
>  qerror.h |   15 +++++++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/qerror.c b/qerror.c
> index 96fbe71..2963b8c 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -304,6 +304,26 @@ static const QErrorStringTable qerror_table[] = {
>          .error_fmt = QERR_VNC_SERVER_FAILED,
>          .desc      = "Could not start VNC server on %(target)",
>      },
> +    {
> +        .error_fmt = QERR_SOCKET_CONNECT_IN_PROGRESS,
> +        .desc      = "Connection can not be completed immediately",
> +    },
> +    {
> +        .error_fmt = QERR_SOCKET_CONNECT_FAILED,
> +        .desc      = "Failed to connect socket",
> +    },
> +    {
> +        .error_fmt = QERR_SOCKET_LISTEN_FAILED,
> +        .desc      = "Failed to listen socket",
> +    },
> +    {
> +        .error_fmt = QERR_SOCKET_BIND_FAILED,
> +        .desc      = "Failed to bind socket",
> +    },
> +    {
> +        .error_fmt = QERR_SOCKET_CREATE_FAILED,
> +        .desc      = "Failed to create socket",
> +    },
>      {}
>  };
> 
> diff --git a/qerror.h b/qerror.h
> index 5c23c1f..4cbba48 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -248,4 +248,19 @@ QError *qobject_to_qerror(const QObject *obj);
>  #define QERR_VNC_SERVER_FAILED \
>      "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
> 
> +#define QERR_SOCKET_CONNECT_IN_PROGRESS \
> +    "{ 'class': 'SockConnectInprogress', 'data': {} }"
> +
> +#define QERR_SOCKET_CONNECT_FAILED \
> +    "{ 'class': 'SockConnectFailed', 'data': {} }"
> +
> +#define QERR_SOCKET_LISTEN_FAILED \
> +    "{ 'class': 'SockListenFailed', 'data': {} }"
> +
> +#define QERR_SOCKET_BIND_FAILED \
> +    "{ 'class': 'SockBindFailed', 'data': {} }"
> +
> +#define QERR_SOCKET_CREATE_FAILED \
> +    "{ 'class': 'SockCreateFailed', 'data': {} }"
> +
>  #endif /* QERROR_H */
>

Patch

diff --git a/qerror.c b/qerror.c
index 96fbe71..2963b8c 100644
--- a/qerror.c
+++ b/qerror.c
@@ -304,6 +304,26 @@  static const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_VNC_SERVER_FAILED,
         .desc      = "Could not start VNC server on %(target)",
     },
+    {
+        .error_fmt = QERR_SOCKET_CONNECT_IN_PROGRESS,
+        .desc      = "Connection can not be completed immediately",
+    },
+    {
+        .error_fmt = QERR_SOCKET_CONNECT_FAILED,
+        .desc      = "Failed to connect socket",
+    },
+    {
+        .error_fmt = QERR_SOCKET_LISTEN_FAILED,
+        .desc      = "Failed to listen socket",
+    },
+    {
+        .error_fmt = QERR_SOCKET_BIND_FAILED,
+        .desc      = "Failed to bind socket",
+    },
+    {
+        .error_fmt = QERR_SOCKET_CREATE_FAILED,
+        .desc      = "Failed to create socket",
+    },
     {}
 };
 
diff --git a/qerror.h b/qerror.h
index 5c23c1f..4cbba48 100644
--- a/qerror.h
+++ b/qerror.h
@@ -248,4 +248,19 @@  QError *qobject_to_qerror(const QObject *obj);
 #define QERR_VNC_SERVER_FAILED \
     "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
 
+#define QERR_SOCKET_CONNECT_IN_PROGRESS \
+    "{ 'class': 'SockConnectInprogress', 'data': {} }"
+
+#define QERR_SOCKET_CONNECT_FAILED \
+    "{ 'class': 'SockConnectFailed', 'data': {} }"
+
+#define QERR_SOCKET_LISTEN_FAILED \
+    "{ 'class': 'SockListenFailed', 'data': {} }"
+
+#define QERR_SOCKET_BIND_FAILED \
+    "{ 'class': 'SockBindFailed', 'data': {} }"
+
+#define QERR_SOCKET_CREATE_FAILED \
+    "{ 'class': 'SockCreateFailed', 'data': {} }"
+
 #endif /* QERROR_H */