Raphael TEYSSANDIER
03/19/2025, 8:33 AMDarwinHttpRequestException
, with the error Kubernetes Ingress Controller Fake Certificate i: Kubernetes Ingress Controller Fake Certificate
I dunno where to catch this error ?Aleksei Tirman [JB]
03/19/2025, 8:53 AMRaphael TEYSSANDIER
03/19/2025, 8:54 AMREQUEST https:/xxxx/configurations failed with exception: io.ktor.client.engine.darwin.DarwinHttpRequestException: Exception in http request: Error Domain=NSURLErrorDomain Code=-1200 "Une erreur SSL s’est produite et il est impossible d’établir une connexion sécurisée avec le serveur." UserInfo={NSLocalizedRecoverySuggestion=Voulez-vous tout de même vous connecter à ce serveur ?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x1138c3c00) s: Kubernetes Ingress Controller Fake Certificate i: Kubernetes Ingress Controller Fake Certificate>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https:/xxxx/configurations, NSErrorFailingURLStringKey=https:/xxxx/configurations, NSUnderlyingError=0x600000dcc5a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x60000350aec0>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x1138c3c00) s: Kubernetes Ingress Controller Fake Certificate i: Kubernetes Ingress Controller Fake Certificate>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <48BAF2A6-1A6B-4AAD-B45A-7E936A3D3F88>.<1>"
), _kCFStreamErrorCodeKey=-9802, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <48BAF2A6-1A6B-4AAD-B45A-7E936A3D3F88>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x60000350aec0>, NSLocalizedDescription=Une erreur SSL s’est produite et il est impossible d’établir une connexion sécurisée avec le serveur.}
Exception doesn't match @Throws-specified class list and thus isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
Uncaught Kotlin exception: io.ktor.client.engine.darwin.DarwinHttpRequestException: Exception in http request: Error Domain=NSURLErrorDomain Code=-1200 "Une erreur SSL s’est produite et il est impossible d’établir une connexion sécurisée avec le serveur." UserInfo={NSLocalizedRecoverySuggestion=Voulez-vous tout de même vous connecter à ce serveur ?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x1138c3c00) s: Kubernetes Ingress Controller Fake Certificate i: Kubernetes Ingress Controller Fake Certificate>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https:/xxxx/configurations, NSErrorFailingURLStringKey=https:/xxxx/configurations, NSUnderlyingError=0x600000dcc5a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x60000350aec0>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x1138c3c00) s: Kubernetes Ingress Controller Fake Certificate i: Kubernetes Ingress Controller Fake Certificate>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <48BAF2A6-1A6B-4AAD-B45A-7E936A3D3F88>.<1>"
), _kCFStreamErrorCodeKey=-9802, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <48BAF2A6-1A6B-4AAD-B45A-7E936A3D3F88>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x60000350aec0>, NSLocalizedDescription=Une erreur SSL s’est produite et il est impossible d’établir une connexion sécurisée avec le serveur.}
Raphael TEYSSANDIER
03/19/2025, 8:55 AMAleksei Tirman [JB]
03/19/2025, 9:00 AMRaphael TEYSSANDIER
03/19/2025, 9:02 AMAleksei Tirman [JB]
03/19/2025, 9:23 AMDarwinHttpRequestException
with the following code:
try {
client.get("<https://untrusted-root.badssl.com/>")
} catch (e: DarwinHttpRequestException) {
println(e)
}
Raphael TEYSSANDIER
03/19/2025, 9:24 AMsuspend inline fun <T : Any> customRunCatching(block: () -> T): CustomResult<T> {
return try {
CustomResult.success(block())
} catch (e: Exception) {
e.toCustomResult()
}
}
customRunCatching { client.get("....") }
Raphael TEYSSANDIER
03/19/2025, 9:24 AMAleksei Tirman [JB]
03/19/2025, 9:27 AMAleksei Tirman [JB]
03/19/2025, 9:29 AMCustomResult
to be thrown somewhere later?Raphael TEYSSANDIER
03/19/2025, 9:36 AMRaphael TEYSSANDIER
03/19/2025, 9:37 AMRaphael TEYSSANDIER
03/19/2025, 1:11 PMexpectSuccess = true
, and it throw 2 times, first is catch but not the second?Aleksei Tirman [JB]
03/19/2025, 2:16 PMThrowable
to make sure the exception is definitely caught.Raphael TEYSSANDIER
03/19/2025, 3:36 PMCLOVIS
03/20/2025, 1:57 PM