DocumentPostFailure Method |
Posts a failure to be displayed to the user at the end of transaction.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 26.0.4.0 (26.0.4.0)
Syntaxpublic FailureMessageKey PostFailure(
FailureMessage failure
)
Public Function PostFailure (
failure As FailureMessage
) As FailureMessageKey
public:
FailureMessageKey^ PostFailure(
FailureMessage^ failure
)
member PostFailure :
failure : FailureMessage -> FailureMessageKey
Parameters
- failure FailureMessage
-
The failure to be posted.
Return Value
FailureMessageKey
A unique key that identifies posted failure message in a document. If exactly the same error is posted more than once,
and not removed between the postings, returned key will be the same every time.
ExceptionsException | Condition |
---|
ArgumentNullException |
A non-optional argument was null
|
InvalidOperationException |
Document must be in state of accepting posted failures and the failures must be appropriate
for that current state.
|
ModificationForbiddenException |
The document is in failure mode: an operation has failed,
and Revit requires the user to either cancel the operation
or fix the problem (usually by deleting certain elements).
-or-
The document is being loaded, or is in the midst of another
sensitive process.
|
ModificationOutsideTransactionException |
The document has no open transaction.
|
Remarks
If code inside transaction detects a problem that needs to be communicated to the user,
it should report these conditions via this method. Failures will be validated and possibly
resolved at the end of transaction.
Warnings posted via this method will not be stored in the document after they are resolved.
A unique key returned by postFailure can be stored for the lifetime of transaction and used to
remove failure message if it is no longer relevant.
See Also