0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / StdLDrivers / StdLDrivers_DocumentRetrievalDriver.cxx
index 5c2ebad..9adb12e 100644 (file)
@@ -95,13 +95,13 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
     PCDM_ReadWriter::Open (*aFileDriver, theFileName, Storage_VSRead);
     myReaderStatus = PCDM_RS_OK;
   } 
-  catch (Standard_Failure)
+  catch (Standard_Failure const& anException)
   {
     myReaderStatus = PCDM_RS_OpenError;
 
     Standard_SStream aMsg;
-    aMsg << Standard_Failure::Caught() << endl;
-    Standard_Failure::Raise (aMsg);
+    aMsg << anException << endl;
+    throw Standard_Failure(aMsg.str().c_str());
   }
   
   // Read header section
@@ -124,7 +124,7 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
 
     Standard_SStream aMsg;
     aMsg << "could not find any document in this file" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
   }
 
   // Select instantiators for the used types
@@ -164,7 +164,7 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
         else                             aMsg << endl;
       }
 
-      Standard_Failure::Raise (aMsg);
+      throw Standard_Failure(aMsg.str().c_str());
     }
   }
 
@@ -231,7 +231,7 @@ void StdLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
                                                 const Handle(CDM_Document)&     /*theDoc*/,
                                                 const Handle(CDM_Application)&  /*theApplication*/)
 {
-  Standard_NotImplemented::Raise ("Reading from stream is not supported by StdLDrivers_DocumentRetrievalDriver");
+  throw Standard_NotImplemented("Reading from stream is not supported by StdLDrivers_DocumentRetrievalDriver");
 }
 
 //=======================================================================
@@ -253,37 +253,37 @@ void StdLDrivers_DocumentRetrievalDriver::raiseOnStorageError (Storage_Error the
   case Storage_VSAlreadyOpen:
     myReaderStatus = PCDM_RS_OpenError;
     aMsg << "Stream Open Error" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   case Storage_VSModeError:
     myReaderStatus = PCDM_RS_WrongStreamMode;
     aMsg << "Stream is opened with a wrong mode for operation" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   case Storage_VSSectionNotFound:
     myReaderStatus = PCDM_RS_FormatFailure;
     aMsg << "Section is not found" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   case Storage_VSFormatError:
     myReaderStatus = PCDM_RS_FormatFailure;
     aMsg << "Wrong format error" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   case Storage_VSUnknownType:
     myReaderStatus = PCDM_RS_TypeFailure;
     aMsg << "Try to read an unknown type" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   case Storage_VSTypeMismatch:
     myReaderStatus = PCDM_RS_TypeFailure;
     aMsg << "Try to read a wrong primitive type" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
 
   default:
     myReaderStatus = PCDM_RS_DriverFailure;
     aMsg << "Retrieval Driver Failure" << endl;
-    Standard_Failure::Raise (aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
   }
 }