mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
b0c2ca6c1b
* use new layered architecture in get dimension keys request * go lint fixes * pr feedback * more pr feedback * remove not used code * refactor route middleware * change signature * add integration tests for the dimension keys route * use request suffix instead of query * use typed args also in frontend * remove unused import * harmonize naming * fix merge conflict
23 lines
394 B
Go
23 lines
394 B
Go
package models
|
|
|
|
import "fmt"
|
|
|
|
type HttpError struct {
|
|
Message string
|
|
Error string
|
|
StatusCode int
|
|
}
|
|
|
|
func NewHttpError(message string, statusCode int, err error) *HttpError {
|
|
httpError := &HttpError{
|
|
Message: message,
|
|
StatusCode: statusCode,
|
|
}
|
|
if err != nil {
|
|
httpError.Error = err.Error()
|
|
httpError.Message = fmt.Sprintf("%s: %s", message, err)
|
|
}
|
|
|
|
return httpError
|
|
}
|