Skip to content

Commit

Permalink
Map java.net.ConnectException to TimeoutException
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasGB authored and nielsvanvelzen committed Jul 23, 2022
1 parent 34aa838 commit 98bbef9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.jellyfin.sdk.api.sockets.SocketInstance
import org.jellyfin.sdk.model.ClientInfo
import org.jellyfin.sdk.model.DeviceInfo
import org.jellyfin.sdk.model.UUID
import java.net.ConnectException
import java.net.UnknownHostException
import io.ktor.http.HttpMethod as KtorHttpMethod

Expand Down Expand Up @@ -113,6 +114,9 @@ public actual open class KtorClient actual constructor(
} catch (err: SocketTimeoutException) {
logger.debug(err) { "Socket timed out" }
throw TimeoutException("Socket timed out", err)
} catch (err: ConnectException) {
logger.debug(err) { "Connection failed" }
throw TimeoutException("Connection failed", err)
} catch (err: NoTransformationFoundException) {
logger.error(err) { "Requested model does not exist" }
throw InvalidContentException("Requested model does not exist", err)
Expand Down

0 comments on commit 98bbef9

Please sign in to comment.