summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-12-06 00:45:42 +0100
committerWerner Koch <wk@gnupg.org>2001-12-06 00:45:42 +0100
commit64c36057ebb82486eb94949e82fb4b9f5b6b789a (patch)
tree99dab0d09c819efd48328222f547773ed8251d8f
parentassuan-connect.c (assuan_pipe_connect): Add more error reporting. (diff)
downloadgnupg2-64c36057ebb82486eb94949e82fb4b9f5b6b789a.tar.xz
gnupg2-64c36057ebb82486eb94949e82fb4b9f5b6b789a.zip
New error codes and another mapping fnc.
-rw-r--r--common/errors.h3
-rw-r--r--common/maperror.c24
-rw-r--r--common/util.h1
3 files changed, 27 insertions, 1 deletions
diff --git a/common/errors.h b/common/errors.h
index ba48b4681..b704ff3c7 100644
--- a/common/errors.h
+++ b/common/errors.h
@@ -53,6 +53,9 @@ enum {
GNUPG_File_Create_Error = 24,
GNUPG_File_Error = 25,
GNUPG_Not_Supported = 26,
+ GNUPG_Invalid_Data = 27,
+ GNUPG_Assuan_Server_Fault = 28,
+ GNUPG_Assuan_Error = 29, /* catch all assuan error */
};
/* Status codes - fixme: should go into another file */
diff --git a/common/maperror.c b/common/maperror.c
index 894e235ca..aba0ee750 100644
--- a/common/maperror.c
+++ b/common/maperror.c
@@ -30,7 +30,7 @@
#include "util.h"
#include "errors.h"
-
+#include "../assuan/assuan.h"
/* Note: we might want to wrap this in a macro to get our hands on
the line and file where the error occired */
@@ -83,3 +83,25 @@ map_kbx_err (int err)
return err;
}
+
+int
+map_assuan_err (int err)
+{
+ switch (err)
+ {
+ case -1:
+ case 0:
+ break;
+
+ case ASSUAN_Not_Implemented: err = GNUPG_Not_Implemented; break;
+ case ASSUAN_Server_Fault: err = GNUPG_Assuan_Server_Fault; break;
+ case ASSUAN_No_Public_Key: err = GNUPG_No_Public_Key; break;
+ case ASSUAN_No_Secret_Key: err = GNUPG_No_Secret_Key; break;
+
+ default:
+ err = err < 100? GNUPG_Assuan_Server_Fault : GNUPG_Assuan_Error;
+ break;
+ }
+ return err;
+}
+
diff --git a/common/util.h b/common/util.h
index 478d851eb..485cc1c05 100644
--- a/common/util.h
+++ b/common/util.h
@@ -52,6 +52,7 @@
int map_ksba_err (int err);
int map_gcry_err (int err);
int map_kbx_err (int err);
+int map_assuan_err (int err);
#endif /*GNUPG_COMMON_UTIL_H*/