Should Entity#close throw Exception?
- Dominant language
- Java
- Stars
- 100
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Description
`Entity` extends `Autoclosable` allowing `Entity#close` to throw any `Exception`. However both `Segment` and `Subsegment` interfaces override `close` to ditch the `Exception`. This discrepancy causes me troubles as it means that `(Subs|S)egment` can be easily wrapped in a try-with-resource statement but doing the same with `Entity` requires an explicit error path.
Why would `Entity#close` throw a checked `Exception`? As `AWSXrayRecorder#end(Subs|S)egment` only raise `(Subs|S)egementNotFoundException` and close seems an _alternative_ way to end an entity, I wouldn't expect it to throw any exception. What is the caller expected to do when a such exception is thrown?
My current understanding of the API is that `Entity#close` should not throw and this is an oversight but please correct me if I am wrong.
Contributor guide
Assessment
This issue has not been assessed yet.