summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-13 15:25:12 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-13 15:25:12 +0200
commit5f91c97c19741e94550364bdd3b53e80e228a158 (patch)
tree95e7991065a9c5510a7c6a13cf06b559ea52db98
parent036a384fbfd65d38a9131c11ae447722297bb170 (diff)
OAuth: Wrap template errors
-rw-r--r--internal/oauth/oauth.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index 2d97056..6fd7481 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -269,15 +269,19 @@ type oauthResponseHTML struct {
}
func writeResponseHTML(w http.ResponseWriter, title string, message string) error {
+ errorMessage := "failed writing response HTML"
template, templateErr := template.New("oauth-response").Parse(responseTemplate)
if templateErr != nil {
- return templateErr
+ return &types.WrappedErrorMessage{Message: errorMessage, Err: templateErr}
}
- template.Execute(w, oauthResponseHTML{
+ executeErr := template.Execute(w, oauthResponseHTML{
Title: title,
Message: message,
})
+ if executeErr != nil {
+ return &types.WrappedErrorMessage{Message: errorMessage, Err: executeErr}
+ }
return nil
}