api: return 404 when an entity is not found (#2582) (#2920)

This commit is contained in:
Alessandro Ros 2024-01-18 23:28:56 +01:00 committed by GitHub
parent b3eaec50c1
commit 7b9617f2e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 269 additions and 41 deletions

View File

@ -808,6 +808,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: path not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -876,6 +882,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: path not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -910,6 +922,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: path not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -938,6 +956,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: path not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1008,6 +1032,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: muxer not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1078,6 +1108,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: path not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1148,6 +1184,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1218,6 +1260,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1246,6 +1294,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1316,6 +1370,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1386,6 +1446,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1414,6 +1480,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1484,6 +1556,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1512,6 +1590,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1582,6 +1666,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1610,6 +1700,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1680,6 +1776,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1708,6 +1810,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: connection not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1778,6 +1886,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:
@ -1806,6 +1920,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: server error.
content:

View File

@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"reflect"
@ -19,6 +20,11 @@ import (
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
"github.com/bluenviron/mediamtx/internal/servers/hls"
"github.com/bluenviron/mediamtx/internal/servers/rtmp"
"github.com/bluenviron/mediamtx/internal/servers/rtsp"
"github.com/bluenviron/mediamtx/internal/servers/srt"
"github.com/bluenviron/mediamtx/internal/servers/webrtc"
)
func interfaceIsEmpty(i interface{}) bool {
@ -264,7 +270,6 @@ func (a *API) Log(level logger.Level, format string, args ...interface{}) {
a.Parent.Log(level, "[API] "+format, args...)
}
// error coming from something the user inserted into the request.
func (a *API) writeError(ctx *gin.Context, status int, err error) {
// show error in logs
a.Log(logger.Error, err.Error())
@ -385,7 +390,7 @@ func (a *API) onConfigPathsGet(ctx *gin.Context) {
p, ok := c.Paths[name]
if !ok {
a.writeError(ctx, http.StatusInternalServerError, fmt.Errorf("path configuration not found"))
a.writeError(ctx, http.StatusNotFound, fmt.Errorf("path configuration not found"))
return
}
@ -450,7 +455,11 @@ func (a *API) onConfigPathsPatch(ctx *gin.Context) { //nolint:dupl
err = newConf.PatchPath(name, &p)
if err != nil {
a.writeError(ctx, http.StatusBadRequest, err)
if errors.Is(err, conf.ErrPathNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusBadRequest, err)
}
return
}
@ -487,7 +496,11 @@ func (a *API) onConfigPathsReplace(ctx *gin.Context) { //nolint:dupl
err = newConf.ReplacePath(name, &p)
if err != nil {
a.writeError(ctx, http.StatusBadRequest, err)
if errors.Is(err, conf.ErrPathNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusBadRequest, err)
}
return
}
@ -517,7 +530,11 @@ func (a *API) onConfigPathsDelete(ctx *gin.Context) {
err := newConf.RemovePath(name)
if err != nil {
a.writeError(ctx, http.StatusBadRequest, err)
if errors.Is(err, conf.ErrPathNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusBadRequest, err)
}
return
}
@ -560,7 +577,11 @@ func (a *API) onPathsGet(ctx *gin.Context) {
data, err := a.PathManager.APIPathsGet(name)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, conf.ErrPathNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -594,7 +615,11 @@ func (a *API) onRTSPConnsGet(ctx *gin.Context) {
data, err := a.RTSPServer.APIConnsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -628,7 +653,11 @@ func (a *API) onRTSPSessionsGet(ctx *gin.Context) {
data, err := a.RTSPServer.APISessionsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -644,7 +673,11 @@ func (a *API) onRTSPSessionsKick(ctx *gin.Context) {
err = a.RTSPServer.APISessionsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -678,7 +711,11 @@ func (a *API) onRTSPSConnsGet(ctx *gin.Context) {
data, err := a.RTSPSServer.APIConnsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -712,7 +749,11 @@ func (a *API) onRTSPSSessionsGet(ctx *gin.Context) {
data, err := a.RTSPSServer.APISessionsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -728,7 +769,11 @@ func (a *API) onRTSPSSessionsKick(ctx *gin.Context) {
err = a.RTSPSServer.APISessionsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtsp.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -762,7 +807,11 @@ func (a *API) onRTMPConnsGet(ctx *gin.Context) {
data, err := a.RTMPServer.APIConnsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtmp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -778,7 +827,11 @@ func (a *API) onRTMPConnsKick(ctx *gin.Context) {
err = a.RTMPServer.APIConnsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtmp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -812,7 +865,11 @@ func (a *API) onRTMPSConnsGet(ctx *gin.Context) {
data, err := a.RTMPSServer.APIConnsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtmp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -828,7 +885,11 @@ func (a *API) onRTMPSConnsKick(ctx *gin.Context) {
err = a.RTMPSServer.APIConnsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, rtmp.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -862,7 +923,11 @@ func (a *API) onHLSMuxersGet(ctx *gin.Context) {
data, err := a.HLSServer.APIMuxersGet(name)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, hls.ErrMuxerNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -896,7 +961,11 @@ func (a *API) onWebRTCSessionsGet(ctx *gin.Context) {
data, err := a.WebRTCServer.APISessionsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, webrtc.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -912,7 +981,11 @@ func (a *API) onWebRTCSessionsKick(ctx *gin.Context) {
err = a.WebRTCServer.APISessionsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, webrtc.ErrSessionNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -946,7 +1019,11 @@ func (a *API) onSRTConnsGet(ctx *gin.Context) {
data, err := a.SRTServer.APIConnsGet(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, srt.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}
@ -962,7 +1039,11 @@ func (a *API) onSRTConnsKick(ctx *gin.Context) {
err = a.SRTServer.APIConnsKick(uuid)
if err != nil {
a.writeError(ctx, http.StatusInternalServerError, err)
if errors.Is(err, srt.ErrConnNotFound) {
a.writeError(ctx, http.StatusNotFound, err)
} else {
a.writeError(ctx, http.StatusInternalServerError, err)
}
return
}

View File

@ -4,6 +4,7 @@ package conf
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"reflect"
@ -21,6 +22,9 @@ import (
"github.com/bluenviron/mediamtx/internal/logger"
)
// ErrPathNotFound is returned when a path is not found.
var ErrPathNotFound = errors.New("path not found")
func sortedKeys(paths map[string]*OptionalPath) []string {
ret := make([]string, len(paths))
i := 0
@ -531,7 +535,7 @@ func (conf *Conf) AddPath(name string, p *OptionalPath) error {
func (conf *Conf) PatchPath(name string, optional2 *OptionalPath) error {
optional, ok := conf.OptionalPaths[name]
if !ok {
return fmt.Errorf("path not found")
return ErrPathNotFound
}
copyStructFields(optional.Values, optional2.Values)
@ -542,7 +546,7 @@ func (conf *Conf) PatchPath(name string, optional2 *OptionalPath) error {
func (conf *Conf) ReplacePath(name string, optional2 *OptionalPath) error {
_, ok := conf.OptionalPaths[name]
if !ok {
return fmt.Errorf("path not found")
return ErrPathNotFound
}
conf.OptionalPaths[name] = optional2
@ -552,7 +556,7 @@ func (conf *Conf) ReplacePath(name string, optional2 *OptionalPath) error {
// RemovePath removes a path.
func (conf *Conf) RemovePath(name string) error {
if _, ok := conf.OptionalPaths[name]; !ok {
return fmt.Errorf("path not found")
return ErrPathNotFound
}
delete(conf.OptionalPaths, name)

View File

@ -374,7 +374,7 @@ func TestAPIConfigPathsDelete(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()
require.Equal(t, http.StatusInternalServerError, res.StatusCode)
require.Equal(t, http.StatusNotFound, res.StatusCode)
checkError(t, "path configuration not found", res.Body)
}()
}
@ -630,7 +630,7 @@ func TestAPIPathsGet(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()
require.Equal(t, http.StatusInternalServerError, res.StatusCode)
require.Equal(t, http.StatusNotFound, res.StatusCode)
checkError(t, "path not found", res.Body)
}
})
@ -1317,7 +1317,7 @@ func TestAPIProtocolGetNotFound(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()
require.Equal(t, http.StatusInternalServerError, res.StatusCode)
require.Equal(t, http.StatusNotFound, res.StatusCode)
switch ca {
case "rtsp conns", "rtsps conns", "rtmp", "rtmps", "srt":
@ -1541,7 +1541,7 @@ func TestAPIProtocolKickNotFound(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()
require.Equal(t, http.StatusInternalServerError, res.StatusCode)
require.Equal(t, http.StatusNotFound, res.StatusCode)
switch ca {
case "rtsp conns", "rtsps conns", "rtmp", "rtmps", "srt":

View File

@ -388,7 +388,7 @@ func (pm *pathManager) doAPIPathsList(req pathAPIPathsListReq) {
func (pm *pathManager) doAPIPathsGet(req pathAPIPathsGetReq) {
path, ok := pm.paths[req.name]
if !ok {
req.res <- pathAPIPathsGetRes{err: fmt.Errorf("path not found")}
req.res <- pathAPIPathsGetRes{err: conf.ErrPathNotFound}
return
}

View File

@ -3,6 +3,7 @@ package hls
import (
"context"
"errors"
"fmt"
"sort"
"sync"
@ -12,6 +13,9 @@ import (
"github.com/bluenviron/mediamtx/internal/logger"
)
// ErrMuxerNotFound is returned when a muxer is not found.
var ErrMuxerNotFound = errors.New("muxer not found")
type serverAPIMuxersListRes struct {
data *defs.APIHLSMuxerList
err error
@ -179,7 +183,7 @@ outer:
case req := <-s.chAPIMuxerGet:
muxer, ok := s.muxers[req.name]
if !ok {
req.res <- serverAPIMuxersGetRes{err: fmt.Errorf("muxer not found")}
req.res <- serverAPIMuxersGetRes{err: ErrMuxerNotFound}
continue
}

View File

@ -4,6 +4,7 @@ package rtmp
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"sort"
@ -18,6 +19,9 @@ import (
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
)
// ErrConnNotFound is returned when a connection is not found.
var ErrConnNotFound = errors.New("connection not found")
type serverAPIConnsListRes struct {
data *defs.APIRTMPConnList
err error
@ -196,7 +200,7 @@ outer:
case req := <-s.chAPIConnsGet:
c := s.findConnByUUID(req.uuid)
if c == nil {
req.res <- serverAPIConnsGetRes{err: fmt.Errorf("connection not found")}
req.res <- serverAPIConnsGetRes{err: ErrConnNotFound}
continue
}
@ -205,7 +209,7 @@ outer:
case req := <-s.chAPIConnsKick:
c := s.findConnByUUID(req.uuid)
if c == nil {
req.res <- serverAPIConnsKickRes{err: fmt.Errorf("connection not found")}
req.res <- serverAPIConnsKickRes{err: ErrConnNotFound}
continue
}

View File

@ -4,6 +4,7 @@ package rtsp
import (
"context"
"crypto/tls"
"errors"
"fmt"
"sort"
"strings"
@ -22,6 +23,12 @@ import (
"github.com/bluenviron/mediamtx/internal/logger"
)
// ErrConnNotFound is returned when a connection is not found.
var ErrConnNotFound = errors.New("connection not found")
// ErrSessionNotFound is returned when a session is not found.
var ErrSessionNotFound = errors.New("session not found")
func printAddresses(srv *gortsplib.Server) string {
var ret []string
@ -356,7 +363,7 @@ func (s *Server) APIConnsGet(uuid uuid.UUID) (*defs.APIRTSPConn, error) {
conn := s.findConnByUUID(uuid)
if conn == nil {
return nil, fmt.Errorf("connection not found")
return nil, ErrConnNotFound
}
return conn.apiItem(), nil
@ -401,7 +408,7 @@ func (s *Server) APISessionsGet(uuid uuid.UUID) (*defs.APIRTSPSession, error) {
_, sx := s.findSessionByUUID(uuid)
if sx == nil {
return nil, fmt.Errorf("session not found")
return nil, ErrSessionNotFound
}
return sx.apiItem(), nil
@ -420,7 +427,7 @@ func (s *Server) APISessionsKick(uuid uuid.UUID) error {
key, sx := s.findSessionByUUID(uuid)
if sx == nil {
return fmt.Errorf("session not found")
return ErrSessionNotFound
}
sx.Close()

View File

@ -3,6 +3,7 @@ package srt
import (
"context"
"errors"
"fmt"
"sort"
"sync"
@ -17,6 +18,9 @@ import (
"github.com/bluenviron/mediamtx/internal/logger"
)
// ErrConnNotFound is returned when a connection is not found.
var ErrConnNotFound = errors.New("connection not found")
func srtMaxPayloadSize(u int) int {
return ((u - 16) / 188) * 188 // 16 = SRT header, 188 = MPEG-TS packet
}
@ -189,7 +193,7 @@ outer:
case req := <-s.chAPIConnsGet:
c := s.findConnByUUID(req.uuid)
if c == nil {
req.res <- serverAPIConnsGetRes{err: fmt.Errorf("connection not found")}
req.res <- serverAPIConnsGetRes{err: ErrConnNotFound}
continue
}
@ -198,7 +202,7 @@ outer:
case req := <-s.chAPIConnsKick:
c := s.findConnByUUID(req.uuid)
if c == nil {
req.res <- serverAPIConnsKickRes{err: fmt.Errorf("connection not found")}
req.res <- serverAPIConnsKickRes{err: ErrConnNotFound}
continue
}

View File

@ -7,6 +7,7 @@ import (
"crypto/rand"
"crypto/sha1"
"encoding/base64"
"errors"
"fmt"
"net"
"net/http"
@ -33,6 +34,9 @@ const (
webrtcPayloadMaxSize = 1188 // 1200 - 12 (RTP header)
)
// ErrSessionNotFound is returned when a session is not found.
var ErrSessionNotFound = errors.New("session not found")
type nilWriter struct{}
func (nilWriter) Write(p []byte) (int, error) {
@ -334,7 +338,7 @@ outer:
case req := <-s.chAddSessionCandidates:
sx, ok := s.sessionsBySecret[req.secret]
if !ok {
req.res <- webRTCAddSessionCandidatesRes{err: fmt.Errorf("session not found")}
req.res <- webRTCAddSessionCandidatesRes{err: ErrSessionNotFound}
continue
}
@ -343,7 +347,7 @@ outer:
case req := <-s.chDeleteSession:
sx, ok := s.sessionsBySecret[req.secret]
if !ok {
req.res <- webRTCDeleteSessionRes{err: fmt.Errorf("session not found")}
req.res <- webRTCDeleteSessionRes{err: ErrSessionNotFound}
continue
}
@ -371,7 +375,7 @@ outer:
case req := <-s.chAPISessionsGet:
sx := s.findSessionByUUID(req.uuid)
if sx == nil {
req.res <- serverAPISessionsGetRes{err: fmt.Errorf("session not found")}
req.res <- serverAPISessionsGetRes{err: ErrSessionNotFound}
continue
}
@ -380,7 +384,7 @@ outer:
case req := <-s.chAPIConnsKick:
sx := s.findSessionByUUID(req.uuid)
if sx == nil {
req.res <- serverAPISessionsKickRes{err: fmt.Errorf("session not found")}
req.res <- serverAPISessionsKickRes{err: ErrSessionNotFound}
continue
}