Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tools/code/publisher/ProductApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -164,8 +165,13 @@ private static PutProductApiInApim GetPutProductApiInApim(IServiceProvider provi
{
logger.LogInformation("Adding API {ApiName} to product {ProductName}...", name, productName);

await ProductApiUri.From(name, productName, serviceUri)
.PutDto(dto, pipeline, cancellationToken);
try {
await ProductApiUri.From(name, productName, serviceUri)
.PutDto(dto, pipeline, cancellationToken);
} catch (HttpRequestException httpRequestException) when (httpRequestException.Message.Contains("API not found", StringComparison.OrdinalIgnoreCase)){
logger.LogWarning("API {ApiName} not found, the API is NOT added to product in the target environment.", name);
return;
}
};
}

Expand Down Expand Up @@ -246,4 +252,4 @@ await ProductApiUri.From(name, productName, serviceUri)
.Delete(pipeline, cancellationToken);
};
}
}
}