mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-03 03:17:21 +00:00
Added RemoteSource.kt exception catch, dependencies update
This commit is contained in:
1 parent
5ba7ee746c
commit
04029d50db
4 files changed
+27
-20
No files matched your search
@@ -9,7 +9,11 @@ import java.net.URL
|
||||
class RemoteSource(private val ioDispatcher: CoroutineDispatcher) : RemoteDataSource {
|
||||
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
override suspend fun fetchFileStream(fileUrl: String): InputStream {
|
||||
return withContext(ioDispatcher) { URL(fileUrl).openStream() }
|
||||
override suspend fun fetchFileStream(url: String): InputStream? {
|
||||
return try {
|
||||
withContext(ioDispatcher) { URL(url).openStream() }
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user