message: Add confirmation before automatically deleting server on failed installs
diff: @@ -397,27 +397,25 @@ export class App {
  // it again.
  return;
  }
  - if (managedServer.isInstallCompleted()) {
  // This server has already been successfully installed, however
  // we may have failed to reach it - this could be due to bad wifi,
  // firewalls, etc. Notify the user and only delete if the user requests it.
  + const errorMessage = managedServer.isInstallCompleted()
  + ? 'We are unable to connect to your Outline server at the moment. This may be due to a firewall on your network or temporary connectivity issues with digitalocean.com.'
  + : 'There was an error creating your Outline server. This may be due to a firewall on your network or temporary connectivity issues with digitalocean.com.';
  this.appRoot.showModalDialog(
  null, // Don't display any title.
  - 'We are unable to reach your Outline server at the moment.',
  + errorMessage,
  ['Delete this server', 'Try again'])
  .then((clickedButtonIndex: number) => {
  if (clickedButtonIndex === 0) { // user clicked 'Delete this server'
  - this.cancelServerCreation(managedServer);
  + managedServer.getHost().delete().then(() => {
  + this.showCreateServer();
  + });
  } else if (clickedButtonIndex === 1) { // user clicked 'Try again'.
  this.showManagedServer(managedServer, true);
  }
  });
  - return;
  - }
  - // An error occured while installing this server.
  - // Show an error and cancel the server creation (e.g. delete the droplet).
  - this.handleServerCreationFailure('Got an error while waiting on server installation', e);
  - this.cancelServerCreation(managedServer);
  });
  }
  @@ -432,10 +430,10 @@ export class App {
  this.showManagedServer(managedServer);
  })
  .catch((e) => {
  - // Don't show a dialog on the login screen.
  - if (!(e instanceof digitalocean_api.XhrError)) {
  - this.handleServerCreationFailure('Failed to create DigitalOcean server', e);
  - }
  + // Sanity check - this error is not expected to occur, as showManagedServer
  + // has it's own error handling.
  + console.error('error from showManagedServer', e);
  + return Promise.reject(e);
  });
  }
  