Revamp exception handling. ImportErrorException renamed to DeadlyImportError to avoid silent regressions. Exceptions now thrown by value, and caught by reference. Put guards in all C++ and C API functions to avoid unwanted exception propagation across module and language boundaries.

PLEASE TEST CAREFULLY IF THIS SHOULD CAUSE REGRESSIONS.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@617 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2010-03-18 17:00:12 +00:00
parent 79c14ce896
commit 762a7df46a
61 changed files with 565 additions and 354 deletions

View File

@@ -96,12 +96,12 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
// Check whether we can read from the file
if( file.get() == NULL)
throw new ImportErrorException( "Failed to open B3D file " + pFile + ".");
throw DeadlyImportError( "Failed to open B3D file " + pFile + ".");
// check whether the .b3d file is large enough to contain
// at least one chunk.
size_t fileSize = file->FileSize();
if( fileSize<8 ) throw new ImportErrorException( "B3D File is too small.");
if( fileSize<8 ) throw DeadlyImportError( "B3D File is too small.");
_pos=0;
_buf.resize( fileSize );
@@ -113,7 +113,7 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
// ------------------------------------------------------------------------------------------------
void B3DImporter::Oops(){
throw new ImportErrorException( "B3D Importer - INTERNAL ERROR" );
throw DeadlyImportError( "B3D Importer - INTERNAL ERROR" );
}
// ------------------------------------------------------------------------------------------------
@@ -121,7 +121,7 @@ void B3DImporter::Fail( string str ){
#ifdef DEBUG_B3D
cout<<"Error in B3D file data: "<<str<<endl;
#endif
throw new ImportErrorException( "B3D Importer - error in B3D file data: "+str );
throw DeadlyImportError( "B3D Importer - error in B3D file data: "+str );
}
// ------------------------------------------------------------------------------------------------