diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2026-01-24 01:57:33 +0100 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2026-01-24 01:57:33 +0100 |
| commit | 39c6170ccab2977bbbaecdde2fdff772f39e2415 (patch) | |
| tree | 97d1d360e8ce62517a573380c0c03362915e55e8 /cmd/generate/templates.go.tmpl | |
| parent | 1fe804770391a644e23eea7c22e0868e3dfb4d2e (diff) | |
| download | hh-main.tar.gz | |
Diffstat (limited to 'cmd/generate/templates.go.tmpl')
| -rw-r--r-- | cmd/generate/templates.go.tmpl | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/generate/templates.go.tmpl b/cmd/generate/templates.go.tmpl index 3533b2b..9ee259b 100644 --- a/cmd/generate/templates.go.tmpl +++ b/cmd/generate/templates.go.tmpl @@ -66,6 +66,28 @@ func hh_{{ $fn.Name }}(w http.ResponseWriter, r *http.Request) { } } {{ end }} - {{ $fn.Name }}(parsed) + {{ if $fn.ResponseHasMain -}} + res + {{- end -}} + {{- if and $fn.ResponseHasMain $fn.ResponseHasError -}} + , + {{- end -}} + {{- if $fn.ResponseHasError -}} + err + {{- end -}} + {{- if or $fn.ResponseHasMain $fn.ResponseHasError -}} + := + {{- end -}} + {{- $fn.Name }}(parsed) + + {{ if $fn.ResponseHasError }} + if err != nil { + panic("todo: Internal server error in " + {{ $fn.Name | quote }} + ": " + err.Error()) + // return + } + {{ end }} + {{ if $fn.ResponseHasMain -}} + res.Respond(w, r) + {{- end -}} } {{ end }} |
