Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6b804c

Browse files
committed
chore: improve vpn configuration errors
1 parentfaaa0af commite6b804c

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

‎Coder-Desktop/Coder-Desktop/VPN/NetworkExtension.swift‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extension CoderVPNService {
4444
tryawaitremoveNetworkExtension()
4545
}catch{
4646
logger.error("remove tunnel failed:\(error)")
47-
neState=.failed(error.localizedDescription)
47+
neState=.failed("Failed to remove configuration:\(error.description)")
4848
return
4949
}
5050
logger.debug("inserting new tunnel")
@@ -60,7 +60,9 @@ extension CoderVPNService {
6060
}catch{
6161
// This typically fails when the user declines the permission dialog
6262
logger.error("save tunnel failed:\(error)")
63-
neState=.failed("Failed to save tunnel:\(error.localizedDescription). Try logging in and out again.")
63+
neState=.failed(
64+
"Failed to save configuration:\(error.localizedDescription). Try logging in and out again."
65+
)
6466
}
6567
}
6668

@@ -71,17 +73,24 @@ extension CoderVPNService {
7173
tryawait tunnel.removeFromPreferences()
7274
}
7375
}catch{
74-
throw.internalError("couldn't remove tunnels:\(error)")
76+
throw.internalError(error.localizedDescription)
7577
}
7678
}
7779

7880
func startTunnel()async{
81+
lettm:NETunnelProviderManager
82+
do{
83+
tm=tryawaitgetTunnelManager()
84+
}catch{
85+
logger.error("get tunnel:\(error)")
86+
neState=.failed("Failed to get VPN configuration:\(error.description)")
87+
return
88+
}
7989
do{
80-
lettm=tryawaitgetTunnelManager()
8190
try tm.connection.startVPNTunnel()
8291
}catch{
8392
logger.error("start tunnel:\(error)")
84-
neState=.failed(error.localizedDescription)
93+
neState=.failed("Failed to start VPN tunnel:\(error.localizedDescription)")
8594
return
8695
}
8796
logger.debug("started tunnel")
@@ -94,7 +103,7 @@ extension CoderVPNService {
94103
tm.connection.stopVPNTunnel()
95104
}catch{
96105
logger.error("stop tunnel:\(error)")
97-
neState=.failed(error.localizedDescription)
106+
neState=.failed("Failed to stop VPN tunnel:\(error.localizedDescription)")
98107
return
99108
}
100109
logger.debug("stopped tunnel")

‎Coder-Desktop/Coder-Desktop/VPN/VPNService.swift‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum VPNServiceError: Error, Equatable {
3737
case systemExtensionError(SystemExtensionState)
3838
case networkExtensionError(NetworkExtensionState)
3939

40-
vardescription:String{
40+
publicvardescription:String{
4141
switchself{
4242
caselet.internalError(description):
4343
"Internal Error:\(description)"
@@ -48,7 +48,7 @@ enum VPNServiceError: Error, Equatable {
4848
}
4949
}
5050

51-
varlocalizedDescription:String{ description}
51+
publicvarlocalizedDescription:String{ description}
5252
}
5353

5454
@MainActor
@@ -126,13 +126,13 @@ final class CoderVPNService: NSObject, VPNService {
126126
// this just configures the VPN, it doesn't enable it
127127
tunnelState=.disabled
128128
}else{
129-
do{
129+
dothrows(VPNServiceError){
130130
tryawaitremoveNetworkExtension()
131131
neState=.unconfigured
132132
tunnelState=.disabled
133133
} catch{
134-
logger.error("failed to removenetwork extension:\(error)")
135-
neState=.failed(error.localizedDescription)
134+
logger.error("failed to removeconfiguration:\(error)")
135+
neState=.failed("Failed to remove configuration:\(error.description)")
136136
}
137137
}
138138
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp