Skip to content

Property IgnoreErrors

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

IgnoreErrors

Gets or sets a value indicating whether gets or sets whether errors in this teardown method should be ignored. When true, exceptions from this method will be logged but will not prevent other teardown methods from executing or the disconnection from proceeding.

csharp
public bool IgnoreErrors { get; set; }

Property Value

bool

Examples

[Teardown(IgnoreErrors = true)]
private async Task LogFinalStateAsync()
{
    // Nice to have, but not critical if it fails
    await ExecuteAsync("log_final_device_state()");
}

[Teardown(IgnoreErrors = false)]
private async Task EmergencyStopAsync()
{
    // Critical safety operation - must succeed
    await ExecuteAsync("emergency_stop_all_actuators()");
}

Remarks

Set IgnoreErrors to true for teardown operations that are helpful but not critical, such as logging final state or cleaning up optional resources. Always keep it false for operations that could leave the device in an unsafe state if they fail.

Even when errors are ignored, they are still logged for diagnostic purposes. Teardown methods should still implement their own error handling for non-critical operations.

Released under the Apache License 2.0.