Panic on not existing screen since it makes no sense to return values.
This commit is contained in:
parent
0471ea91c7
commit
05844d2bc0
2 changed files with 3 additions and 8 deletions
|
@ -169,7 +169,7 @@ func (af ActionFunc) Act(c *Context) {
|
|||
}
|
||||
|
||||
// Changes screen of user to the Id one.
|
||||
func (c *Context) Go(pth Path, args ...any) error {
|
||||
func (c *Context) Go(pth Path, args ...any) {
|
||||
if pth == "-" {
|
||||
pth = c.PrevPath()
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ func (c *Context) Go(pth Path, args ...any) error {
|
|||
}
|
||||
|
||||
if !c.PathExist(pth) {
|
||||
return ScreenNotExistErr
|
||||
panic(ScreenNotExistErr)
|
||||
}
|
||||
c.prevPath = c.path
|
||||
c.path = pth
|
||||
|
@ -193,8 +193,6 @@ func (c *Context) Go(pth Path, args ...any) error {
|
|||
} else {
|
||||
panic("no widget defined for the screen")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Context) PathExist(pth Path) bool {
|
||||
|
|
|
@ -11,10 +11,7 @@ type ScreenGo struct {
|
|||
}
|
||||
|
||||
func (sc ScreenGo) Act(c *Context) {
|
||||
err := c.Go(sc.Path, sc.Args...)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
c.Go(sc.Path, sc.Args...)
|
||||
}
|
||||
|
||||
// The same as Act.
|
||||
|
|
Loading…
Reference in a new issue