1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

GO-4384 Add a non panicking method shouldcomponent

This commit is contained in:
Mikhail Iudin 2024-12-11 13:50:48 +01:00
parent 16aa0c4c2f
commit 7c5c5c1ed8
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0

View file

@ -23,11 +23,11 @@ var (
) )
var ( var (
log = logger.NewNamed("app") log = logger.NewNamed("app")
StopDeadline = time.Minute StopDeadline = time.Minute
StopWarningAfter = time.Second * 10 StopWarningAfter = time.Second * 10
StartWarningAfter = time.Second * 10 StartWarningAfter = time.Second * 10
ComponentNotFound = errors.New("component not found") ErrComponentNotFound = errors.New("component not found")
) )
// Component is a minimal interface for a common app.Component // Component is a minimal interface for a common app.Component
@ -194,7 +194,7 @@ func GetComponent[t any](app *App) (t, error) {
} }
current = current.parent current = current.parent
} }
return empty, ComponentNotFound return empty, ErrComponentNotFound
} }
// MustComponent - generic version of app.MustComponent // MustComponent - generic version of app.MustComponent