/// <summary>
 /// Wraps the call to CreateClient, handling any specific errors that could be thrown
 /// around invalid PAT and account name and wraps them in a ValidationException with
 /// a helpful message.
 /// </summary>
 private WorkItemClientConnection CreateValidationClient(ConfigConnection connection)
 {
     try
     {
         return(ClientHelpers.CreateClient(connection));
     }
     catch (Exception e) when(e is VssServiceResponseException && e.Message == "The resource cannot be found.")
     {
         throw new ValidationException(connection.Account, (VssServiceResponseException)e);
     }
     catch (Exception e) when(e is VssUnauthorizedException)
     {
         throw new ValidationException(connection.Account, (VssUnauthorizedException)e);
     }
 }
Ejemplo n.º 2
0
 public MigrationContext(ConfigJson configJson)
 {
     this.Config       = configJson;
     this.SourceClient = ClientHelpers.CreateClient(configJson.SourceConnection);
     this.TargetClient = ClientHelpers.CreateClient(configJson.TargetConnection);
 }