mirror of
https://github.com/mum4k/termdash.git
synced 2025-04-27 13:48:49 +08:00
Adding an "Error" event type.
This commit is contained in:
parent
1911e2190a
commit
19fb73bc55
@ -277,6 +277,7 @@ func TestDraw(t *testing.T) {
|
|||||||
return ft
|
return ft
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// TODO(mum4k): Tests where widget removes children and vice versa.
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package terminalapi
|
package terminalapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
|
|
||||||
"github.com/mum4k/termdash/keyboard"
|
"github.com/mum4k/termdash/keyboard"
|
||||||
@ -46,3 +47,16 @@ type Mouse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (*Mouse) isEvent() {}
|
func (*Mouse) isEvent() {}
|
||||||
|
|
||||||
|
// Error is an event indicating an error while processing input.
|
||||||
|
type Error string
|
||||||
|
|
||||||
|
func (*Error) isEvent() {}
|
||||||
|
|
||||||
|
// Error returns the error that occurred.
|
||||||
|
func (e *Error) Error() error {
|
||||||
|
if e == nil || *e == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New(e)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user