revitron.failure¶
This is a helper submodule for handling errors and warnings occuring in transactions.
Classes:
|
This class implements the |
A basic failure handler. |
|
|
This class implements the |
|
This class implements the |
- class ErrorCatcher(*args: Any, **kwargs: Any)[source]¶
Bases:
IFailuresPreprocessor
This class implements the
IFailurePreprocessor
interface and can be used as a preprocessor for rolling back on errors.- Parameters
IFailuresPreprocessor (interface) – The Revit API IFailuresPreprocessor interface.
Methods:
PreprocessFailures
(failuresAccessor)Preprocess all failures and returns a ProceedWithRollBack result on error.
- PreprocessFailures(failuresAccessor)[source]¶
Preprocess all failures and returns a ProceedWithRollBack result on error.
- Parameters
failuresAccessor (object) – The Revit API
FailuresAccessor
object.- Returns
The
FailureProcessingResult.ProceedWithRollBack
result on error orFailureProcessingResult.Continue
.- Return type
object
- class FailureHandler[source]¶
Bases:
object
A basic failure handler.
Methods:
preprocess
(failuresAccessor[, ...])Preprocess failures by optionally suppressing all warnings and rolling back transactions on error.
- static preprocess(failuresAccessor, suppressWarnings=False, rollbackOnError=False)[source]¶
Preprocess failures by optionally suppressing all warnings and rolling back transactions on error.
- Parameters
failuresAccessor (object) – A Revit failure accessor object.
suppressWarnings (bool, optional) – Optionally suppress all warnings. Defaults to False.
rollbackOnError (bool, optional) – Optionally roll back on errors. Defaults to False.
- Returns
A Revit
FailureProcessingResult
- Return type
object
- class WarningAndErrorCatcher(*args: Any, **kwargs: Any)[source]¶
Bases:
IFailuresPreprocessor
This class implements the
IFailurePreprocessor
interface and can be used as a preprocessor for rolling back on errors and muting all warnings.- Parameters
IFailuresPreprocessor (interface) – The Revit API IFailuresPreprocessor interface.
Methods:
PreprocessFailures
(failuresAccessor)Preprocess all failures and returns a ProceedWithRollBack result on error.
- PreprocessFailures(failuresAccessor)[source]¶
Preprocess all failures and returns a ProceedWithRollBack result on error.
- Parameters
failuresAccessor (object) – The Revit API
FailuresAccessor
object.- Returns
The
FailureProcessingResult.ProceedWithRollBack
result on error orFailureProcessingResult.Continue
.- Return type
object
- class WarningCatcher(*args: Any, **kwargs: Any)[source]¶
Bases:
IFailuresPreprocessor
This class implements the
IFailurePreprocessor
interface and can be used as a preprocessor for muting all warnings.- Parameters
IFailuresPreprocessor (interface) – The Revit API IFailuresPreprocessor interface.
Methods:
PreprocessFailures
(failuresAccessor)Preprocess all failures and deletes all warnings to suppress dialog boxes.