diff --git a/runtime/src/commonMain/kotlin/com/collectiveidea/twirp/ServiceException.kt b/runtime/src/commonMain/kotlin/com/collectiveidea/twirp/ServiceException.kt index 1839465..0602689 100644 --- a/runtime/src/commonMain/kotlin/com/collectiveidea/twirp/ServiceException.kt +++ b/runtime/src/commonMain/kotlin/com/collectiveidea/twirp/ServiceException.kt @@ -1,6 +1,13 @@ package com.collectiveidea.twirp +import io.ktor.client.plugins.RedirectResponseException import io.ktor.client.plugins.ResponseException +import io.ktor.http.HttpStatusCode -class ServiceException(val error: ErrorResponse, responseException: ResponseException) : - RuntimeException(error.msg, responseException) +class ServiceException(val error: ErrorResponse, val responseException: ResponseException) : + RuntimeException(error.msg, responseException) { + + fun isNotModifiedException(): Boolean { + return responseException is RedirectResponseException && responseException.response.status == HttpStatusCode.NotModified + } +}