mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 02:48:21 +00:00
Respond with error in case of panic
This commit is contained in:
parent
db4b108ba8
commit
b71525ba30
1 changed files with 1 additions and 0 deletions
|
@ -82,6 +82,7 @@ func (h *Handler) HandleRequest(ctx context.Context, s *session.Session, r io.Re
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
slog.Error("Recovered Panic Executing API Method", fmt.Errorf("%v", r), "method", req.Method, "params", fmt.Sprintf("%+v", params[2]), "id", req.ID, "stack", debug.Stack())
|
slog.Error("Recovered Panic Executing API Method", fmt.Errorf("%v", r), "method", req.Method, "params", fmt.Sprintf("%+v", params[2]), "id", req.ID, "stack", debug.Stack())
|
||||||
|
respondError(w, req.ID, ErrInternalError, fmt.Errorf("%v", r))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
res := method.handlerFunc.Call(params)
|
res := method.handlerFunc.Call(params)
|
||||||
|
|
Loading…
Add table
Reference in a new issue