apache / rocketmq-client-go

Apache RocketMQ go client
https://rocketmq.apache.org/
Apache License 2.0
1.3k stars 421 forks source link

fix WithRecover 无法recover问题 #1074

Open snail-plus opened 1 year ago

snail-plus commented 1 year ago

What is the purpose of the change

fix WithRecover 无法recover

Brief changelog

add PanicHandler handle error

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

cserwen commented 1 year ago

@snail-plus Maybe it would be better to have a simple unit test.

snail-plus commented 1 year ago

@snail-plus Maybe it would be better to have a simple unit test.

ok , I will add a simple unit test later.

twz915 commented 10 months ago

Previously, users could reassign the PanicHandler to their own handler, but now they can’t do it. such as

// 设置recover
primitive.PanicHandler = func(i interface{}) {
    msentry.CaptureMessage(fmt.Sprintf("%+v", i), nil)
}

Please keep the code compatible, thanks!