revitron.failure

This is a helper submodule for handling errors and warnings occuring in transactions.

Classes:

ErrorCatcher(*args, **kwargs)

This class implements the IFailurePreprocessor interface and can be used as a preprocessor for rolling back on errors.

FailureHandler()

A basic failure handler.

WarningAndErrorCatcher(*args, **kwargs)

This class implements the IFailurePreprocessor interface and can be used as a preprocessor for rolling back on errors and muting all warnings.

WarningCatcher(*args, **kwargs)

This class implements the IFailurePreprocessor interface and can be used as a preprocessor for muting all warnings.

class ErrorCatcher(*args: Any, **kwargs: Any)[source]

Bases: Autodesk.Revit.DB.

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 or FailureProcessingResult.Continue.

Return type

object

class FailureHandler[source]

Bases: object

A basic failure handler.

Attributes:

errorMessage

Methods:

preprocess(failuresAccessor[, …])

Preprocess failures by optionally suppressing all warnings and rolling back transactions on error.

errorMessage = ''
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: Autodesk.Revit.DB.

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 or FailureProcessingResult.Continue.

Return type

object

class WarningCatcher(*args: Any, **kwargs: Any)[source]

Bases: Autodesk.Revit.DB.

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.

PreprocessFailures(failuresAccessor)[source]

Preprocess all failures and deletes all warnings to suppress dialog boxes.

Parameters

failuresAccessor (object) – The Revit API FailuresAccessor object.

Returns

The FailureProcessingResult.Continue result

Return type

object