[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-backoffice] branch master updated: Errors mgmt.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-backoffice] branch master updated: Errors mgmt. |
Date: |
Fri, 08 Jun 2018 10:32:40 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository backoffice.
The following commit(s) were added to refs/heads/master by this push:
new cb36375 Errors mgmt.
cb36375 is described below
commit cb36375d76aeb78699a0f0843cfcd7c9cdf714e1
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Jun 8 10:32:03 2018 +0200
Errors mgmt.
Show raw JSON to the user if 'code' field is missing.
---
js/backoffice.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/js/backoffice.js b/js/backoffice.js
index e22c1a1..5ae68e0 100644
--- a/js/backoffice.js
+++ b/js/backoffice.js
@@ -63,7 +63,7 @@ var SCROLL = true;
* Maps error codes from
https://git.taler.net/exchange.git/tree/src/include/taler_error_codes.h
* to friendlier messages.
*/
-function error_map(code){
+function error_map(code, backup_text){
switch (Number(code)){
/* /history errors. */
@@ -87,7 +87,7 @@ function error_map(code){
case 2304:
case 2305:
case 1801:
- return "Merchant database failed, code:" + code;
+ return "Merchant database failed, code: " + code;
case 2306:
return "One of the coin failed at getting its WTID";
@@ -99,7 +99,8 @@ function error_map(code){
return "Error from the exchange, no proof received!";
case 2404:
case 2402:
- return "Database failure, could not store results: " + code;
+ return "Database failure, could not store results, code: " +
+ code;
case 2406:
return "Database failure, could not retrieve previous results";
case 2407:
@@ -115,9 +116,8 @@ function error_map(code){
return "Proposal not found.";
default:
- return "Error code not given.";
+ return backup_text ? backup_text : "Error code not given.";
}
-
}
/**
@@ -272,14 +272,15 @@ var show_error = show_warning = function(response_text){
toggle_loader();
close_popup();
-
+ /* Always dump whole error to the console. */
+ console.log(response_text);
var msg;
var hint = "";
try{
var parse = JSON.parse(response_text);
console.log("Response was at least JSON");
/* handles undefined codes too. */
- msg = error_map(parse['code']);
+ msg = error_map(parse['code'], response_text);
if (parse['hint'])
hint = parse['hint'];
--
To stop receiving notification emails like this one, please contact
address@hidden