Introduce APIError type and make ErrorEvent.Err public

This makes it a little bit easier to act on API errors that happen while
streaming.
This commit is contained in:
Alexander Bakker 2023-03-11 12:10:46 +01:00
parent 9faaa4f0dc
commit 972ffb4771
6 changed files with 49 additions and 24 deletions

View file

@ -40,10 +40,10 @@ type DeleteEvent struct{ ID ID }
func (e *DeleteEvent) event() {}
// ErrorEvent is a struct for passing errors to app.
type ErrorEvent struct{ err error }
type ErrorEvent struct{ Err error }
func (e *ErrorEvent) event() {}
func (e *ErrorEvent) Error() string { return e.err.Error() }
func (e *ErrorEvent) Error() string { return e.Err.Error() }
// Event is an interface passing events to app.
type Event interface {