mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-07 21:47:02 +09:00
GO-4384 Add a non panicking method shouldcomponent
This commit is contained in:
parent
16aa0c4c2f
commit
7c5c5c1ed8
1 changed files with 6 additions and 6 deletions
12
app/app.go
12
app/app.go
|
@ -23,11 +23,11 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
log = logger.NewNamed("app")
|
||||
StopDeadline = time.Minute
|
||||
StopWarningAfter = time.Second * 10
|
||||
StartWarningAfter = time.Second * 10
|
||||
ComponentNotFound = errors.New("component not found")
|
||||
log = logger.NewNamed("app")
|
||||
StopDeadline = time.Minute
|
||||
StopWarningAfter = time.Second * 10
|
||||
StartWarningAfter = time.Second * 10
|
||||
ErrComponentNotFound = errors.New("component not found")
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
return empty, ComponentNotFound
|
||||
return empty, ErrComponentNotFound
|
||||
}
|
||||
|
||||
// MustComponent - generic version of app.MustComponent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue