diff --git a/templates/html/documentation.gohtml b/templates/html/documentation.gohtml index ab74478..5fd55dc 100644 --- a/templates/html/documentation.gohtml +++ b/templates/html/documentation.gohtml @@ -12,7 +12,7 @@

Documentation

- {{ range . }} + {{ range .Data.Buckets }} {{ $bucket_name := .Name }} {{ $bucket_display_name := .DisplayName }}

@@ -26,6 +26,9 @@
{{ end }}

+

+ {{ .Message }} +

diff --git a/web_handlers/web_handlers.go b/web_handlers/web_handlers.go index dc45dfb..872aed5 100644 --- a/web_handlers/web_handlers.go +++ b/web_handlers/web_handlers.go @@ -48,7 +48,11 @@ func HandleDocumentation(c echo.Context) error { client, err := api.NewApiClientFromViper() if err != nil { - return c.Render(http.StatusInternalServerError, "documentation-html", nil) + response.StatusCode = http.StatusInternalServerError + response.Message = "Error during api.NewApiClientFromViper()" + response.Error = err.Error() + + return c.Render(response.StatusCode, "documentation-html", response) } v1BucketListResponse, err := client.ListBuckets() @@ -67,14 +71,22 @@ func HandleDocumentation(c echo.Context) error { // TODO add Response type content, err := client.Call(http.MethodGet, fmt.Sprintf("/v1/bucket/%s", bucket)) if err != nil { - return c.Render(http.StatusInternalServerError, "documentation-html", nil) + response.StatusCode = http.StatusInternalServerError + response.Message = "Error during /v1/bucket/:bucket" + response.Error = err.Error() + + return c.Render(response.StatusCode, "documentation-html", response) } var documents []string err = json.Unmarshal(content, &documents) if err != nil { - return c.Render(http.StatusInternalServerError, "documentation-html", nil) + response.StatusCode = http.StatusInternalServerError + response.Message = "Error during json.Unmarshal /v1/bucket/:bucket" + response.Error = err.Error() + + return c.Render(response.StatusCode, "documentation-html", response) } // Ce bloc retire tous les caractères spéciaux d'une string @@ -107,7 +119,8 @@ func HandleDocumentation(c echo.Context) error { response.StatusCode = http.StatusOK // TODO render .Message - return c.Render(response.StatusCode, "documentation-html", response.Data.Buckets) + return c.Render(response.StatusCode, "documentation-html", response) + //return c.Render(response.StatusCode, "documentation-html", response.Data.Buckets) } func HandleFormulaires(c echo.Context) error {