mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-29 15:20:04 +01:00
62 lines
2.2 KiB
Go
62 lines
2.2 KiB
Go
|
// Code generated by qtc from "error_response.qtpl". DO NOT EDIT.
|
||
|
// See https://github.com/valyala/quicktemplate for details.
|
||
|
|
||
|
// ErrorResponse generates error response for /api/v1/query.See https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:4
|
||
|
package prometheus
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:4
|
||
|
import (
|
||
|
qtio422016 "io"
|
||
|
|
||
|
qt422016 "github.com/valyala/quicktemplate"
|
||
|
)
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:4
|
||
|
var (
|
||
|
_ = qtio422016.Copy
|
||
|
_ = qt422016.AcquireByteBuffer
|
||
|
)
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:4
|
||
|
func StreamErrorResponse(qw422016 *qt422016.Writer, statusCode int, err error) {
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:4
|
||
|
qw422016.N().S(`{"status":"error","errorType":"`)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:7
|
||
|
qw422016.N().D(statusCode)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:7
|
||
|
qw422016.N().S(`","error":`)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:8
|
||
|
qw422016.N().Q(err.Error())
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:8
|
||
|
qw422016.N().S(`}`)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
}
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
func WriteErrorResponse(qq422016 qtio422016.Writer, statusCode int, err error) {
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
StreamErrorResponse(qw422016, statusCode, err)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
}
|
||
|
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
func ErrorResponse(statusCode int, err error) string {
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
WriteErrorResponse(qb422016, statusCode, err)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
return qs422016
|
||
|
//line app/vmselect/prometheus/error_response.qtpl:10
|
||
|
}
|