fix(eventbus): update error handler to include topic information (#333)

* fix(eventbus): update error handler to include topic information

- Modified error handler signature to accept topic string and error
- Updated panic recovery logic to pass event topic to error handler
- Adjusted SetErrorHandler method parameter signature
- Updated example test to demonstrate new error handler usage
- Enhanced error handling test to verify topic information

* fix(eventbus): unit test
This commit is contained in:
chentong authored and GitHub committed 2025-09-28 20:10:12 +08:00
1 parent 15a0dad0d8
commit 8fe56b6dc7
3 files changed
+8 -7

No files matched your search

+2 -1
View File
@@ -114,7 +114,8 @@ func TestEventBus_ErrorHandler(t *testing.T) {
eb := NewEventBus[string]()
eb.SetErrorHandler(func(err error) {
eb.SetErrorHandler(func(topic string, err error) {
assert.Equal("event1", topic)
assert.Equal("error", err.Error())
})