@@ -136,7 +136,9 @@ private constructor(
136136 url(urlString)
137137
138138 headers {
139- mergedHeaders.forEach { (key, value) -> set(key, value) }
139+ for ((key, value) in mergedHeaders) {
140+ set(key, value)
141+ }
140142
141143 val rangeHeader =
142144 HttpUtil .buildRangeRequestHeader(dataSpec.position, dataSpec.length)
@@ -166,23 +168,15 @@ private constructor(
166168 }
167169 this .response = httpResponse
168170 this .responseChannel = channel
169- } catch (_ : CancellationException ) {
170- throw InterruptedIOException ()
171+ } catch (e : CancellationException ) {
172+ throw InterruptedIOException (e.message )
171173 } catch (e: IOException ) {
172174 if (e is HttpDataSource .HttpDataSourceException ) throw e
173175 throw HttpDataSource .HttpDataSourceException .createForIOException(
174176 e,
175177 dataSpec,
176178 HttpDataSource .HttpDataSourceException .TYPE_OPEN ,
177179 )
178- } catch (e: Exception ) {
179- throw HttpDataSource .HttpDataSourceException (
180- e.message ? : " Unknown error" ,
181- null ,
182- dataSpec,
183- PlaybackException .ERROR_CODE_IO_UNSPECIFIED ,
184- HttpDataSource .HttpDataSourceException .TYPE_OPEN ,
185- )
186180 }
187181
188182 val responseCode = httpResponse.status.value
@@ -260,9 +254,9 @@ private constructor(
260254 } catch (e: HttpDataSource .HttpDataSourceException ) {
261255 closeConnectionQuietly()
262256 throw e
263- } catch (_ : CancellationException ) {
257+ } catch (e : CancellationException ) {
264258 closeConnectionQuietly()
265- throw InterruptedIOException ()
259+ throw InterruptedIOException (e.message )
266260 }
267261
268262 return bytesToRead
0 commit comments