cmd/stcrashreceiver: Aggregate slice out of bounds errors

This commit is contained in:
Jakob Borg 2023-09-20 08:52:33 +02:00
parent d4c2acf6f6
commit dc6a10dff4

View File

@ -185,6 +185,7 @@ var (
ldbFileRe = regexp.MustCompile(`(\[file=)([0-9]+)(\.ldb\])`)
ldbInternalKeyRe = regexp.MustCompile(`(internal key ")[^"]+(", len=)[0-9]+`)
ldbPathRe = regexp.MustCompile(`(open|write|read) .+[\\/].+[\\/]index[^\\/]+[\\/][^\\/]+: `)
sliceBoundsRe = regexp.MustCompile(`(slice bounds out of range) \[.+`)
)
func sanitizeMessageLDB(message string) string {
@ -193,6 +194,7 @@ func sanitizeMessageLDB(message string) string {
message = ldbChecksumRe.ReplaceAllString(message, "${1}X${3}X")
message = ldbInternalKeyRe.ReplaceAllString(message, "${1}x${2}x")
message = ldbPathRe.ReplaceAllString(message, "$1 x: ")
message = sliceBoundsRe.ReplaceAllString(message, "$1")
return message
}