mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 08:18:10 -05:00
Chore: Refactor api handlers to use web.Bind (#42199)
* Chore: Refactor api handlers to use web.Bind * fix comments * fix comment * trying to fix most of the tests and force routing.Wrap type check * fix library panels tests * fix frontend logging tests * allow passing nil as a response to skip writing * return nil instead of the response * rewrite login handler function types * remove handlerFuncCtx * make linter happy * remove old bindings from the libraryelements * restore comments
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package frontendlogging
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -93,3 +94,16 @@ func (event *FrontendSentryEvent) ToLogContext(store *SourceMapStore) log15.Ctx
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
||||
func (event *FrontendSentryEvent) MarshalJSON() ([]byte, error) {
|
||||
eventJSON, err := json.Marshal(event.Event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
exceptionJSON, err := json.Marshal(map[string]interface{}{"exception": event.Exception})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
exceptionJSON[0] = ','
|
||||
return append(eventJSON[:len(eventJSON)-1], exceptionJSON...), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user