Hey everyone. Does anyone know how to gracefully c...
# dotnet
s
Hey everyone. Does anyone know how to gracefully continue when a resource fails? I'm currently trying to work with CertificateBinding - but when it fails it halts the entire stack. I'd rather it just logged the error and moved on (we can always bind the cert manually if needed). I've tried wrapping it a try/catch but it still halts execution
Copy code
try
{
    <http://Log.Info|Log.Info>("Binding Certificate to the staging domain");
    var certBindingStaging = new CertificateBinding($"web-{args.Platform}-{args.StackName}-certificateBinding-staging", new()
    {
        CertificateId = certificateStaging.Id,
        HostnameBindingId = stageBinding.Id,
        SslState = "SniEnabled"
    },
    new()
    {
        DependsOn = { stageBinding, certificateStaging },
        Parent = this,
    });
    <http://Log.Info|Log.Info>("Certificate binding done");
}
catch (Exception ex)
{
    <http://Log.Info|Log.Info>($"Error binding certificate: {ex.Message}");
}