From b1280007e756a25a7b70d826b0885018b146f8fc Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Fri, 26 Jun 2020 14:57:33 -0700 Subject: [PATCH] Return a better error on session recording lookup Instead of `0 not found`, return an error earlier, when loading index files. --- lib/events/auditlog.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/events/auditlog.go b/lib/events/auditlog.go index c2715925ba4f2..7558bb8d58b68 100644 --- a/lib/events/auditlog.go +++ b/lib/events/auditlog.go @@ -560,6 +560,11 @@ func readSessionIndex(dataDir string, authServers []string, namespace string, si return nil, trace.Wrap(err) } } + + if len(index.indexFiles) == 0 { + return nil, trace.NotFound("session %q not found", sid) + } + index.sort() return &index, nil }