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:
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 (
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue