From 6079b1d963f34ada5c4b25363f2319901e283936 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 8 Jun 2024 00:01:44 +0200 Subject: feat: Add error handling --- templates/error.qtpl | 16 +++++ templates/error.qtpl.go | 162 ++++++++++++++++++++++++++++++++++++++++++++++ templates/gititem.qtpl | 2 +- templates/gititem.qtpl.go | 4 +- 4 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 templates/error.qtpl create mode 100644 templates/error.qtpl.go (limited to 'templates') diff --git a/templates/error.qtpl b/templates/error.qtpl new file mode 100644 index 0000000..771d533 --- /dev/null +++ b/templates/error.qtpl @@ -0,0 +1,16 @@ +{% code +type ErrorPage struct { + Message string +} +%} + +{% func (p *ErrorPage) Title() %}Error{% endfunc %} + +{% func (p *ErrorPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} + +{% func (p *ErrorPage) Content() %} +{%s p.Message %} +{% endfunc %} + +{% func (p *ErrorPage) Script() %} +{% endfunc %} diff --git a/templates/error.qtpl.go b/templates/error.qtpl.go new file mode 100644 index 0000000..099395f --- /dev/null +++ b/templates/error.qtpl.go @@ -0,0 +1,162 @@ +// Code generated by qtc from "error.qtpl". DO NOT EDIT. +// See https://github.com/valyala/quicktemplate for details. + +//line error.qtpl:1 +package templates + +//line error.qtpl:1 +import ( + qtio422016 "io" + + qt422016 "github.com/valyala/quicktemplate" +) + +//line error.qtpl:1 +var ( + _ = qtio422016.Copy + _ = qt422016.AcquireByteBuffer +) + +//line error.qtpl:2 +type ErrorPage struct { + Message string +} + +//line error.qtpl:7 +func (p *ErrorPage) StreamTitle(qw422016 *qt422016.Writer) { +//line error.qtpl:7 + qw422016.N().S(`Error`) +//line error.qtpl:7 +} + +//line error.qtpl:7 +func (p *ErrorPage) WriteTitle(qq422016 qtio422016.Writer) { +//line error.qtpl:7 + qw422016 := qt422016.AcquireWriter(qq422016) +//line error.qtpl:7 + p.StreamTitle(qw422016) +//line error.qtpl:7 + qt422016.ReleaseWriter(qw422016) +//line error.qtpl:7 +} + +//line error.qtpl:7 +func (p *ErrorPage) Title() string { +//line error.qtpl:7 + qb422016 := qt422016.AcquireByteBuffer() +//line error.qtpl:7 + p.WriteTitle(qb422016) +//line error.qtpl:7 + qs422016 := string(qb422016.B) +//line error.qtpl:7 + qt422016.ReleaseByteBuffer(qb422016) +//line error.qtpl:7 + return qs422016 +//line error.qtpl:7 +} + +//line error.qtpl:9 +func (p *ErrorPage) StreamNavbar(qw422016 *qt422016.Writer) { +//line error.qtpl:9 + StreamNavbar(qw422016, Git) +//line error.qtpl:9 +} + +//line error.qtpl:9 +func (p *ErrorPage) WriteNavbar(qq422016 qtio422016.Writer) { +//line error.qtpl:9 + qw422016 := qt422016.AcquireWriter(qq422016) +//line error.qtpl:9 + p.StreamNavbar(qw422016) +//line error.qtpl:9 + qt422016.ReleaseWriter(qw422016) +//line error.qtpl:9 +} + +//line error.qtpl:9 +func (p *ErrorPage) Navbar() string { +//line error.qtpl:9 + qb422016 := qt422016.AcquireByteBuffer() +//line error.qtpl:9 + p.WriteNavbar(qb422016) +//line error.qtpl:9 + qs422016 := string(qb422016.B) +//line error.qtpl:9 + qt422016.ReleaseByteBuffer(qb422016) +//line error.qtpl:9 + return qs422016 +//line error.qtpl:9 +} + +//line error.qtpl:11 +func (p *ErrorPage) StreamContent(qw422016 *qt422016.Writer) { +//line error.qtpl:11 + qw422016.N().S(` +`) +//line error.qtpl:12 + qw422016.E().S(p.Message) +//line error.qtpl:12 + qw422016.N().S(` +`) +//line error.qtpl:13 +} + +//line error.qtpl:13 +func (p *ErrorPage) WriteContent(qq422016 qtio422016.Writer) { +//line error.qtpl:13 + qw422016 := qt422016.AcquireWriter(qq422016) +//line error.qtpl:13 + p.StreamContent(qw422016) +//line error.qtpl:13 + qt422016.ReleaseWriter(qw422016) +//line error.qtpl:13 +} + +//line error.qtpl:13 +func (p *ErrorPage) Content() string { +//line error.qtpl:13 + qb422016 := qt422016.AcquireByteBuffer() +//line error.qtpl:13 + p.WriteContent(qb422016) +//line error.qtpl:13 + qs422016 := string(qb422016.B) +//line error.qtpl:13 + qt422016.ReleaseByteBuffer(qb422016) +//line error.qtpl:13 + return qs422016 +//line error.qtpl:13 +} + +//line error.qtpl:15 +func (p *ErrorPage) StreamScript(qw422016 *qt422016.Writer) { +//line error.qtpl:15 + qw422016.N().S(` +`) +//line error.qtpl:16 +} + +//line error.qtpl:16 +func (p *ErrorPage) WriteScript(qq422016 qtio422016.Writer) { +//line error.qtpl:16 + qw422016 := qt422016.AcquireWriter(qq422016) +//line error.qtpl:16 + p.StreamScript(qw422016) +//line error.qtpl:16 + qt422016.ReleaseWriter(qw422016) +//line error.qtpl:16 +} + +//line error.qtpl:16 +func (p *ErrorPage) Script() string { +//line error.qtpl:16 + qb422016 := qt422016.AcquireByteBuffer() +//line error.qtpl:16 + p.WriteScript(qb422016) +//line error.qtpl:16 + qs422016 := string(qb422016.B) +//line error.qtpl:16 + qt422016.ReleaseByteBuffer(qb422016) +//line error.qtpl:16 + return qs422016 +//line error.qtpl:16 +} diff --git a/templates/gititem.qtpl b/templates/gititem.qtpl index 3e2dd4e..d695782 100644 --- a/templates/gititem.qtpl +++ b/templates/gititem.qtpl @@ -13,7 +13,7 @@ type GitItemPage struct { } %} -{% func (p *GitItemPage) Title() %}Git | List{% endfunc %} +{% func (p *GitItemPage) Title() %}Git | {%s p.Name %}{% endfunc %} {% func (p *GitItemPage) Navbar() %}{%= Navbar(Git) %}{% endfunc %} diff --git a/templates/gititem.qtpl.go b/templates/gititem.qtpl.go index 2c46104..a7ed659 100644 --- a/templates/gititem.qtpl.go +++ b/templates/gititem.qtpl.go @@ -44,7 +44,9 @@ type GitItemPage struct { //line gititem.qtpl:16 func (p *GitItemPage) StreamTitle(qw422016 *qt422016.Writer) { //line gititem.qtpl:16 - qw422016.N().S(`Git | List`) + qw422016.N().S(`Git | `) +//line gititem.qtpl:16 + qw422016.E().S(p.Name) //line gititem.qtpl:16 } -- cgit v1.2.3