throw InvalidResponseCodeException instead of HttpDataSourceException

if responseCode and responseMessage ara available always throws an InvalidResponseCodeException instead of HttpDataSourceException, so in onPlayerError method the http status code and message can be used to decide what will be the next step.
This commit is contained in:
Emanuele Tidó 2020-12-30 16:50:04 +00:00 committed by GitHub
parent 1347d572ef
commit 625c46e963
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -377,8 +377,8 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
errorResponseBody =
errorStream != null ? Util.toByteArray(errorStream) : Util.EMPTY_BYTE_ARRAY;
} catch (IOException e) {
throw new HttpDataSourceException(
"Error reading non-2xx response body", e, dataSpec, HttpDataSourceException.TYPE_OPEN);
throw new InvalidResponseCodeException(
responseCode, responseMessage, headers, dataSpec, null);
}
closeConnectionQuietly();
InvalidResponseCodeException exception =