[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taldir] branch master updated: implement proper pms error handling
From: |
gnunet |
Subject: |
[taldir] branch master updated: implement proper pms error handling |
Date: |
Wed, 22 Jan 2025 11:17:40 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new c40760d implement proper pms error handling
c40760d is described below
commit c40760dcde0b690498d92875f96a5e90a2ead9b2
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Jan 22 11:17:33 2025 +0100
implement proper pms error handling
---
pkg/rest/taldir.go | 1 +
web/templates/lookup_result.html | 16 +++++++++-------
web/templates/nav.html | 2 +-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index 85b02de..933f909 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -475,6 +475,7 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r
*http.Request) {
if nil != err {
errDetail.Code = gana.GENERIC_JSON_INVALID
errDetail.Hint = err.Error()
+ w.Header().Set("Content-Type", "application/json")
resp, _ := json.Marshal(errDetail)
w.WriteHeader(400)
w.Write(resp)
diff --git a/web/templates/lookup_result.html b/web/templates/lookup_result.html
index 9bb9efe..4f26336 100644
--- a/web/templates/lookup_result.html
+++ b/web/templates/lookup_result.html
@@ -12,15 +12,13 @@
<body>
{{ template "nav.html" . }}
<div class="container pt-5">
- {{if .error}}
- <div class="container pt-5">
- <div id="ebanner" class="alert alert-danger" role="alert">
+ <div id="ebanner" class="container pt-5" hidden>
+ <div class="alert alert-danger" role="alert">
<h4 class="alert-heading">{{ call .tr "error" }}</h4>
<hr>
- <p class="mb-0">{{.error}}.</p>
+ <p class="mb-0" id="ebanner-text">{{.error}}.</p>
</div>
</div>
- {{end}}
<div id="sbanner" class="container pt-5" hidden>
<div class="alert alert-success" role="alert">
<h4 class="alert-heading">{{ call .tr "validationInitiated" }}</h4>
@@ -51,7 +49,7 @@
</form>
{{else}}
<div class="container pt-5">
- <div id="ebanner" class="alert alert-dark" role="alert">
+ <div class="alert alert-dark" role="alert">
<h4 class="alert-heading">Found!</h4>
<hr>
<p class="mb-0">{{ call .tr "isLinked" .address }}</p>
@@ -95,7 +93,11 @@
var sbanner = document.getElementById('sbanner');
sbanner.hidden = false;
} else {
- window.location.href = "/?error=Registration failed";
+ var jsonResponse = JSON.parse(xhr.responseText);
+ document.getElementById('ebanner-text').innerHTML =
jsonResponse.hint;
+ var ebanner = document.getElementById('ebanner');
+ ebanner.hidden = false;
+ // window.location.href = "/?error=Registration failed";
}
}
}
diff --git a/web/templates/nav.html b/web/templates/nav.html
index 159b640..e7ea363 100644
--- a/web/templates/nav.html
+++ b/web/templates/nav.html
@@ -5,7 +5,7 @@
<div>{{ call .tr "title" }}</div>
</div>
</nav>
-<div id="ebanner" class="alert alert-warning" role="alert">
+<div class="alert alert-warning" role="alert">
<h4 class="alert-heading">{{ call .tr "demoService" }}</h4>
<hr>
<p class="mb-0">
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taldir] branch master updated: implement proper pms error handling,
gnunet <=