[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taldir] 02/02: fix error handling somewhat, WIP
From: |
gnunet |
Subject: |
[taldir] 02/02: fix error handling somewhat, WIP |
Date: |
Tue, 21 Jan 2025 22:59:10 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
commit 78790a5d0fd5d272451e6923d76f750c32b6c2f2
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jan 21 22:59:03 2025 +0100
fix error handling somewhat, WIP
---
pkg/rest/taldir.go | 6 +++++-
web/templates/lookup_result.html | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index b76022d..85b02de 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -473,7 +473,11 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r
*http.Request) {
err = t.isPMSValid(req.TargetUri)
if nil != err {
- http.Redirect(w, r, fmt.Sprintf("/?error=%s", err),
http.StatusSeeOther)
+ errDetail.Code = gana.GENERIC_JSON_INVALID
+ errDetail.Hint = err.Error()
+ resp, _ := json.Marshal(errDetail)
+ w.WriteHeader(400)
+ w.Write(resp)
return
}
diff --git a/web/templates/lookup_result.html b/web/templates/lookup_result.html
index 19a06dc..9bb9efe 100644
--- a/web/templates/lookup_result.html
+++ b/web/templates/lookup_result.html
@@ -95,7 +95,7 @@
var sbanner = document.getElementById('sbanner');
sbanner.hidden = false;
} else {
- window.location.href = "?error=Registration failed";
+ window.location.href = "/?error=Registration failed";
}
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.