[management] Add DB access duration to logs for context cancel (#2781)

This commit is contained in:
Pascal Fischer
2024-11-01 10:58:39 +01:00
committed by GitHub
parent 9812de853b
commit bac95ace18
2 changed files with 198 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ package status
import (
"errors"
"fmt"
"time"
)
const (
@@ -115,6 +116,11 @@ func NewGetUserFromStoreError() error {
return Errorf(Internal, "issue getting user from store")
}
// NewStoreContextCanceledError creates a new Error with Internal type for a canceled store context
func NewStoreContextCanceledError(duration time.Duration) error {
return Errorf(Internal, "store access: context canceled after %v", duration)
}
// NewInvalidKeyIDError creates a new Error with InvalidArgument type for an issue getting a setup key
func NewInvalidKeyIDError() error {
return Errorf(InvalidArgument, "invalid key ID")