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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,8 +21,10 @@
#include <gp_XY.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Real.hxx>
class gp_XYZ;
class Plate_D1;
class Plate_D2;

View File

@@ -21,6 +21,7 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <gp_XYZ.hxx>
#include <gp_XY.hxx>

View File

@@ -494,7 +494,7 @@ const char* BRepMesh_Dump(void* theMeshHandlePtr, const char* theFileNameStr)
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
return anException.what();
}
return theFileNameStr;

View File

@@ -2591,7 +2591,7 @@ const char* BRepMesh_DumpPoly(void* thePolygon, void* theMeshHandlePtr, const ch
}
catch (Standard_Failure const& anException)
{
return anException.GetMessageString();
return anException.what();
}
return theFileNameStr;

View File

@@ -266,7 +266,7 @@ bool BRepMesh_Triangulator::triangulate(NCollection_List<Poly_Triangle>& thePoly
{
TCollection_AsciiString aStr(
"makeTrianglesUsingBRepMesh: Exception raised during polygon triangulation: ");
aStr.AssignCat(aFailure.GetMessageString());
aStr.AssignCat(aFailure.what());
myMess->Send(aStr.ToCString(), Message_Fail);
return false;
}

View File

@@ -169,7 +169,7 @@ bool ShapeProcess::Perform(const occ::handle<ShapeProcess_Context>& context,
catch (Standard_Failure const& anException)
{
Message_Msg SMSG2("SP.Sequence.Error.Except"); // Operator %s failed with exception %s
SMSG2 << oper << anException.GetMessageString();
SMSG2 << oper << anException.what();
context->Messenger()->Send(SMSG2, Message_Alarm);
}
}
@@ -213,7 +213,7 @@ bool ShapeProcess::Perform(const occ::handle<ShapeProcess_Context>& theContext,
catch (const Standard_Failure& anException)
{
Message_Msg aMessage("SP.Sequence.Error.Except"); // Operator %s failed with exception %s
aMessage << anOperationName << anException.GetMessageString();
aMessage << anOperationName << anException.what();
theContext->Messenger()->Send(aMessage, Message_Alarm);
}
}

View File

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