Sets options for handling failures to be used when the transaction is being committed or rolled back.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public void SetFailureHandlingOptions(
FailureHandlingOptions options
)
Parameters
- options FailureHandlingOptions
-
An instance of FailureHandlingOptions to be applied to the transaction
Exceptions
Remarks
Options can be set at any time before the transaction is either committed or rolled back.
See
FailureHandlingOptions for details about available options.
Once committed or rolled back, the transaction object will reset its options to their default values.
Example
C#
using (Transaction transaction = new Transaction(doc))
{
transaction.Start("Creating room");
FailureHandlingOptions options = transaction.GetFailureHandlingOptions();
options.SetFailuresPreprocessor(new RoomWarningSwallower());
transaction.SetFailureHandlingOptions(options);
if (null != doc.Create.NewRoom(level, UV.Zero))
{
transaction.Commit();
}
else
{
transaction.RollBack();
}
}
VB
Using transaction As New Transaction(doc)
transaction.Start("Creating room")
Dim options As FailureHandlingOptions = transaction.GetFailureHandlingOptions()
options.SetFailuresPreprocessor(New RoomWarningSwallower())
transaction.SetFailureHandlingOptions(options)
If doc.Create.NewRoom(level, UV.Zero) IsNot Nothing Then
transaction.Commit()
Else
transaction.RollBack()
End If
End Using
See Also
Reference