aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-18 18:29:18 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-18 18:29:18 +0100
commit7d6b8d53d5a6ee6ca1545fb5d458199c6249edc5 (patch)
treef44f7afb792184ef46e6d4882cb20de0e2d8b519 /src/include
parentde68a7b301fd78a89c4f5e6f34791c8debab36e0 (diff)
addressing #4803: nicer error messages for invalid wire formats
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_error_codes.h49
-rw-r--r--src/include/taler_wire_plugin.h10
2 files changed, 54 insertions, 5 deletions
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index dd8a14972..6e6614579 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -48,6 +48,10 @@ enum TALER_ErrorCode
*/
TALER_EC_INVALID_RESPONSE = 2,
+ /**
+ * Generic implementation error: this function was not yet implemented.
+ */
+ TALER_EC_NOT_IMPLEMENTED = 3,
/* ********** generic error codes ************* */
@@ -324,10 +328,11 @@ enum TALER_ErrorCode
/**
* The exchange does not recognize the validity of or support the
- * given wire (bank account) address. This response is provided
+ * given wire format type.
+ * This response is provided
* with HTTP status code MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT = 1209,
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_TYPE = 1209,
/**
* The exchange failed to canonicalize and hash the given wire format.
@@ -354,6 +359,46 @@ enum TALER_ErrorCode
TALER_EC_DEPOSIT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1212,
/**
+ * The exchange detected that the given account number
+ * is invalid for the selected wire format type.
+ * This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_ACCOUNT_NUMBER = 1213,
+
+ /**
+ * The signature over the given wire details is invalid.
+ * This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_SIGNATURE = 1214,
+
+ /**
+ * The bank specified in the wire transfer format is not supported
+ * by this exchange.
+ * This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_BANK = 1215,
+
+ /**
+ * No wire format type was specified in the JSON wire format
+ * details.
+ * This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_TYPE_MISSING = 1216,
+
+ /**
+ * The given wire format type is not supported by this
+ * exchange.
+ * This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_TYPE_UNSUPPORTED = 1217,
+
+
+ /**
* The respective coin did not have sufficient residual value
* for the /refresh/melt operation. The "history" in this
* response provdes the "residual_value" of the coin, which may
diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h
index c3c9c3a54..6c06e8247 100644
--- a/src/include/taler_wire_plugin.h
+++ b/src/include/taler_wire_plugin.h
@@ -24,6 +24,7 @@
#include <gnunet/gnunet_util_lib.h>
#include <jansson.h>
#include "taler_util.h"
+#include "taler_error_codes.h"
/**
@@ -137,12 +138,15 @@ struct TALER_WIRE_Plugin
* @param cls the @e cls of this struct with the plugin-specific state
* @param wire the JSON wire format object
* @param master_pub public key of the exchange to verify against
- * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not
+ * @param[OUT] emsg set to an error message, unless we return #TALER_EC_NONE;
+ * error message must be freed by the caller using GNUNET_free()
+ * @return #TALER_EC_NONE if correctly formatted
*/
- int
+ enum TALER_ErrorCode
(*wire_validate) (void *cls,
const json_t *wire,
- const struct TALER_MasterPublicKeyP *master_pub);
+ const struct TALER_MasterPublicKeyP *master_pub,
+ char **emsg);
/**