mirror of
https://github.com/androidx/media.git
synced 2025-05-11 17:49:52 +08:00

In some DataSources, it is not easy to assign an error code at the throw site. For example, CronetDataSource.readInternal() throws SocketTimeoutException on L1033, and is caught at L754 as IOException and is thrown. We need the logic to assign error code for the actual type of the error cause. While we can certainly do in individual DataSources, IMO there's value in making this logic generic at a higher level (like what is in this CL). The catch and translation logic is borrowed from EPII:L646. PiperOrigin-RevId: 385789629