Open okonos opened 2 years ago
Segment.Close enriches the segment with details specific to the error passed, but since it uses type assertions, the error must be of an exact type:
Segment.Close
https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L118-L123 https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L136-L138 https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L143-L145
Using errors.As there instead of type assertions would make it work with wrapped errors as well.
errors.As
Segment.Close
enriches the segment with details specific to the error passed, but since it uses type assertions, the error must be of an exact type:https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L118-L123 https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L136-L138 https://github.com/aws/aws-xray-sdk-go/blob/053264401e5a9608d10a4c44a613cacd607cfe94/strategy/exception/default_exception_formatting_strategy.go#L143-L145
Using
errors.As
there instead of type assertions would make it work with wrapped errors as well.