summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-06 12:58:37 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-06 12:58:37 +0200
commit50a2eb976314409df5d45d9b417ad5b61e7d208b (patch)
tree92c20d953dfccc0da90fd149880659b7c54178b0
parentc55c79fa5ec6eec660e944abae7412ff6d5a7943 (diff)
State: Remove servers on adding error
-rw-r--r--state.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/state.go b/state.go
index 5a89083..79afeff 100644
--- a/state.go
+++ b/state.go
@@ -281,6 +281,7 @@ func (state *VPNState) GetConfigSecureInternet(
server, serverErr := state.addSecureInternetHomeServer(orgID)
if serverErr != nil {
+ state.RemoveSecureInternet()
return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
@@ -326,6 +327,7 @@ func (state *VPNState) addCustomServer(url string) (server.Server, error) {
server, serverErr := state.Servers.AddCustomServer(customServer, &state.FSM)
if serverErr != nil {
+ state.RemoveCustomServer(url)
return nil, &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
@@ -340,6 +342,7 @@ func (state *VPNState) GetConfigInstituteAccess(url string, forceTCP bool) (stri
server, serverErr := state.addInstituteServer(url)
if serverErr != nil {
+ state.RemoveInstituteAccess(url)
return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
@@ -352,6 +355,8 @@ func (state *VPNState) GetConfigCustomServer(url string, forceTCP bool) (string,
server, serverErr := state.addCustomServer(url)
if serverErr != nil {
+ state.RemoveCustomServer(url)
+ state.GoBack()
return "", "", &types.WrappedErrorMessage{Message: errorMessage, Err: serverErr}
}
@@ -584,7 +589,6 @@ func (state *VPNState) RenewSession() error {
loginErr := server.Login(currentServer)
if loginErr != nil {
- // We are possibly in oauth started
// Go back
state.GoBack()
return &types.WrappedErrorMessage{Message: errorMessage, Err: loginErr}