Foundation Classes - Inherited Standard_Failure from std::exception (#984)

First patch in iterative renovation of exceptions.

- Simplify exception classes to be container of data only.
- Removed redundant inclusion of <Standard_Type.hxx> in various header files across the project.
- Removed Set methods for failure and its define template.
- Removed Raise and Rerise static methods.
- Remove Instance and Throw methods
- Deprecated getting message with old approach, and moving to what()
- Update ErrorHandler to handle only specific list of exceptions.
This commit is contained in:
Pasukhin Dmitry
2026-01-07 12:22:32 +00:00
committed by GitHub
parent 6c6f2ceb41
commit e1d36343e4
174 changed files with 590 additions and 668 deletions

View File

@@ -101,7 +101,7 @@ void IVtkOCC_SelectableObject::ComputeSelection(
catch (const Standard_Failure& anException)
{
Message::SendFail(TCollection_AsciiString("Error: IVtkOCC_SelectableObject::ComputeSelection(")
+ theMode + ") has failed (" + anException.GetMessageString() + ")");
+ theMode + ") has failed (" + anException.what() + ")");
if (theMode == 0)
{
Bnd_Box aBndBox = BoundingBox();

View File

@@ -93,7 +93,7 @@ void IVtkOCC_ShapeMesher::internalBuild()
{
Message::SendFail(TCollection_AsciiString(
"Error: addWireFrameFaces() wireframe presentation builder has failed (")
+ anException.GetMessageString() + ")");
+ anException.what() + ")");
}
}

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_AspectFillAreaDefinitionError_HeaderFile
#define _Aspect_AspectFillAreaDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_AspectLineDefinitionError_HeaderFile
#define _Aspect_AspectLineDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_AspectMarkerDefinitionError_HeaderFile
#define _Aspect_AspectMarkerDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_DisplayConnectionDefinitionError_HeaderFile
#define _Aspect_DisplayConnectionDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_GraphicDeviceDefinitionError_HeaderFile
#define _Aspect_GraphicDeviceDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_IdentDefinitionError_HeaderFile
#define _Aspect_IdentDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_WindowDefinitionError_HeaderFile
#define _Aspect_WindowDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -16,7 +16,6 @@
#ifndef _Aspect_WindowError_HeaderFile
#define _Aspect_WindowError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _Graphic3d_GroupDefinitionError_HeaderFile
#define _Graphic3d_GroupDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _Graphic3d_MaterialDefinitionError_HeaderFile
#define _Graphic3d_MaterialDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _Graphic3d_PriorityDefinitionError_HeaderFile
#define _Graphic3d_PriorityDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _Graphic3d_StructureDefinitionError_HeaderFile
#define _Graphic3d_StructureDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _WNT_ClassDefinitionError_HeaderFile
#define _WNT_ClassDefinitionError_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_ConstructionError.hxx>

View File

@@ -134,7 +134,7 @@ void AIS_Shape::Compute(const occ::handle<PrsMgr_PresentationManager>&,
Message::SendFail(
TCollection_AsciiString(
"Error: AIS_Shape::Compute() wireframe presentation builder has failed (")
+ anException.GetMessageString() + ")");
+ anException.what() + ")");
}
break;
}
@@ -170,7 +170,7 @@ void AIS_Shape::Compute(const occ::handle<PrsMgr_PresentationManager>&,
Message::SendFail(
TCollection_AsciiString(
"Error: AIS_Shape::Compute() shaded presentation builder has failed (")
+ anException.GetMessageString() + ")");
+ anException.what() + ")");
StdPrs_WFShape::Add(thePrs, myshape, myDrawer);
}
}
@@ -273,7 +273,7 @@ void AIS_Shape::computeHlrPresentation(const occ::handle<Graphic3d_Camera>& th
{
Message::SendFail(
TCollection_AsciiString("Error: AIS_Shape::Compute() HLR Algorithm has failed (")
+ anException.GetMessageString() + ")");
+ anException.what() + ")");
StdPrs_WFShape::Add(thePrs, theShape, theDrawer);
}
}
@@ -314,7 +314,7 @@ void AIS_Shape::ComputeSelection(const occ::handle<SelectMgr_Selection>& aSelect
catch (Standard_Failure const& anException)
{
Message::SendFail(TCollection_AsciiString("Error: AIS_Shape::ComputeSelection(") + aMode
+ ") has failed (" + anException.GetMessageString() + ")");
+ ") has failed (" + anException.what() + ")");
if (aMode == 0)
{
aSelection->Clear();

View File

@@ -2977,7 +2977,7 @@ void AIS_ViewController::handleSelectionPoly(const occ::handle<AIS_InteractiveCo
{
Message::SendWarning(
TCollection_AsciiString("Internal error while displaying rubber-band: ")
+ theEx.DynamicType()->Name() + ", " + theEx.GetMessageString());
+ theEx.ExceptionType() + ", " + theEx.what());
myRubberBand->ClearPoints();
}
if (!theView->Viewer()->ZLayerSettings(myRubberBand->ZLayer()).IsImmediate())

View File

@@ -17,7 +17,6 @@
#ifndef _Prs3d_InvalidAngle_HeaderFile
#define _Prs3d_InvalidAngle_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_RangeError.hxx>

View File

@@ -142,8 +142,8 @@ void SelectMgr_BVHThreadPool::BVHThread::performThread()
}
catch (Standard_Failure const& aFailure)
{
TCollection_AsciiString aMsg = TCollection_AsciiString(aFailure.DynamicType()->Name())
+ ": " + aFailure.GetMessageString();
TCollection_AsciiString aMsg =
TCollection_AsciiString(aFailure.ExceptionType()) + ": " + aFailure.what();
Message::DefaultMessenger()->SendFail(aMsg);
}
catch (std::exception& anStdException)

View File

@@ -17,7 +17,6 @@
#ifndef _V3d_BadValue_HeaderFile
#define _V3d_BadValue_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_OutOfRange.hxx>

View File

@@ -17,7 +17,6 @@
#ifndef _V3d_UnMapped_HeaderFile
#define _V3d_UnMapped_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_DomainError.hxx>