github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/verror/Error.html.go (about) 1 // Code generated by qtc from "Error.html". DO NOT EDIT. 2 // See https://github.com/valyala/quicktemplate for details. 3 4 // <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 5 6 //line views/verror/Error.html:2 7 package verror 8 9 //line views/verror/Error.html:2 10 import ( 11 "strings" 12 13 "github.com/kyleu/dbaudit/app" 14 "github.com/kyleu/dbaudit/app/controller/cutil" 15 "github.com/kyleu/dbaudit/app/lib/user" 16 "github.com/kyleu/dbaudit/app/util" 17 "github.com/kyleu/dbaudit/views/layout" 18 ) 19 20 //line views/verror/Error.html:12 21 import ( 22 qtio422016 "io" 23 24 qt422016 "github.com/valyala/quicktemplate" 25 ) 26 27 //line views/verror/Error.html:12 28 var ( 29 _ = qtio422016.Copy 30 _ = qt422016.AcquireByteBuffer 31 ) 32 33 //line views/verror/Error.html:12 34 func streamerrorStack(qw422016 *qt422016.Writer, ed *util.ErrorDetail) { 35 //line views/verror/Error.html:12 36 qw422016.N().S(` <div class="overflow full-width"> 37 <table> 38 <tbody> 39 `) 40 //line views/verror/Error.html:16 41 for _, f := range ed.Stack { 42 //line views/verror/Error.html:16 43 qw422016.N().S(` <tr> 44 <td> 45 `) 46 //line views/verror/Error.html:19 47 if strings.Contains(f.Key, util.AppKey) { 48 //line views/verror/Error.html:19 49 qw422016.N().S(` <div class="error-key error-owned">`) 50 //line views/verror/Error.html:20 51 qw422016.E().S(f.Key) 52 //line views/verror/Error.html:20 53 qw422016.N().S(`</div> 54 `) 55 //line views/verror/Error.html:21 56 } else { 57 //line views/verror/Error.html:21 58 qw422016.N().S(` <div class="error-key">`) 59 //line views/verror/Error.html:22 60 qw422016.E().S(f.Key) 61 //line views/verror/Error.html:22 62 qw422016.N().S(`</div> 63 `) 64 //line views/verror/Error.html:23 65 } 66 //line views/verror/Error.html:23 67 qw422016.N().S(` <div class="error-location">`) 68 //line views/verror/Error.html:24 69 qw422016.E().S(f.Loc) 70 //line views/verror/Error.html:24 71 qw422016.N().S(`</div> 72 </td> 73 </tr> 74 `) 75 //line views/verror/Error.html:27 76 } 77 //line views/verror/Error.html:27 78 qw422016.N().S(` </tbody> 79 </table> 80 </div> 81 `) 82 //line views/verror/Error.html:31 83 } 84 85 //line views/verror/Error.html:31 86 func writeerrorStack(qq422016 qtio422016.Writer, ed *util.ErrorDetail) { 87 //line views/verror/Error.html:31 88 qw422016 := qt422016.AcquireWriter(qq422016) 89 //line views/verror/Error.html:31 90 streamerrorStack(qw422016, ed) 91 //line views/verror/Error.html:31 92 qt422016.ReleaseWriter(qw422016) 93 //line views/verror/Error.html:31 94 } 95 96 //line views/verror/Error.html:31 97 func errorStack(ed *util.ErrorDetail) string { 98 //line views/verror/Error.html:31 99 qb422016 := qt422016.AcquireByteBuffer() 100 //line views/verror/Error.html:31 101 writeerrorStack(qb422016, ed) 102 //line views/verror/Error.html:31 103 qs422016 := string(qb422016.B) 104 //line views/verror/Error.html:31 105 qt422016.ReleaseByteBuffer(qb422016) 106 //line views/verror/Error.html:31 107 return qs422016 108 //line views/verror/Error.html:31 109 } 110 111 //line views/verror/Error.html:33 112 type Error struct { 113 layout.Basic 114 Err *util.ErrorDetail 115 } 116 117 //line views/verror/Error.html:38 118 func (p *Error) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) { 119 //line views/verror/Error.html:38 120 qw422016.N().S(` 121 `) 122 //line views/verror/Error.html:39 123 StreamDetail(qw422016, p.Err, as, ps) 124 //line views/verror/Error.html:39 125 qw422016.N().S(` 126 `) 127 //line views/verror/Error.html:40 128 } 129 130 //line views/verror/Error.html:40 131 func (p *Error) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) { 132 //line views/verror/Error.html:40 133 qw422016 := qt422016.AcquireWriter(qq422016) 134 //line views/verror/Error.html:40 135 p.StreamBody(qw422016, as, ps) 136 //line views/verror/Error.html:40 137 qt422016.ReleaseWriter(qw422016) 138 //line views/verror/Error.html:40 139 } 140 141 //line views/verror/Error.html:40 142 func (p *Error) Body(as *app.State, ps *cutil.PageState) string { 143 //line views/verror/Error.html:40 144 qb422016 := qt422016.AcquireByteBuffer() 145 //line views/verror/Error.html:40 146 p.WriteBody(qb422016, as, ps) 147 //line views/verror/Error.html:40 148 qs422016 := string(qb422016.B) 149 //line views/verror/Error.html:40 150 qt422016.ReleaseByteBuffer(qb422016) 151 //line views/verror/Error.html:40 152 return qs422016 153 //line views/verror/Error.html:40 154 } 155 156 //line views/verror/Error.html:42 157 func StreamDetail(qw422016 *qt422016.Writer, ed *util.ErrorDetail, as *app.State, ps *cutil.PageState) { 158 //line views/verror/Error.html:42 159 qw422016.N().S(` 160 <div class="card"> 161 <h3>`) 162 //line views/verror/Error.html:44 163 qw422016.E().S(ed.Message) 164 //line views/verror/Error.html:44 165 qw422016.N().S(`</h3> 166 <em>Internal Server Error</em> 167 `) 168 //line views/verror/Error.html:46 169 if user.IsAdmin(ps.Accounts) { 170 //line views/verror/Error.html:46 171 qw422016.N().S(` `) 172 //line views/verror/Error.html:47 173 streamerrorStack(qw422016, ed) 174 //line views/verror/Error.html:47 175 qw422016.N().S(` `) 176 //line views/verror/Error.html:47 177 cause := ed.Cause 178 179 //line views/verror/Error.html:47 180 qw422016.N().S(` 181 `) 182 //line views/verror/Error.html:48 183 for cause != nil { 184 //line views/verror/Error.html:48 185 qw422016.N().S(` <h3>Caused by</h3> 186 <div>`) 187 //line views/verror/Error.html:50 188 qw422016.E().S(cause.Message) 189 //line views/verror/Error.html:50 190 qw422016.N().S(`</div>`) 191 //line views/verror/Error.html:50 192 streamerrorStack(qw422016, cause) 193 //line views/verror/Error.html:50 194 cause = cause.Cause 195 196 //line views/verror/Error.html:50 197 qw422016.N().S(` 198 `) 199 //line views/verror/Error.html:51 200 } 201 //line views/verror/Error.html:52 202 } 203 //line views/verror/Error.html:52 204 qw422016.N().S(` </div> 205 `) 206 //line views/verror/Error.html:54 207 } 208 209 //line views/verror/Error.html:54 210 func WriteDetail(qq422016 qtio422016.Writer, ed *util.ErrorDetail, as *app.State, ps *cutil.PageState) { 211 //line views/verror/Error.html:54 212 qw422016 := qt422016.AcquireWriter(qq422016) 213 //line views/verror/Error.html:54 214 StreamDetail(qw422016, ed, as, ps) 215 //line views/verror/Error.html:54 216 qt422016.ReleaseWriter(qw422016) 217 //line views/verror/Error.html:54 218 } 219 220 //line views/verror/Error.html:54 221 func Detail(ed *util.ErrorDetail, as *app.State, ps *cutil.PageState) string { 222 //line views/verror/Error.html:54 223 qb422016 := qt422016.AcquireByteBuffer() 224 //line views/verror/Error.html:54 225 WriteDetail(qb422016, ed, as, ps) 226 //line views/verror/Error.html:54 227 qs422016 := string(qb422016.B) 228 //line views/verror/Error.html:54 229 qt422016.ReleaseByteBuffer(qb422016) 230 //line views/verror/Error.html:54 231 return qs422016 232 //line views/verror/Error.html:54 233 }