Actually, just keep the old behaviour for now.

pull/3375/head
Malcolm Tyrrell 2020-08-20 14:32:15 +01:00
parent 9b5e758bdd
commit 8f893e3653
4 changed files with 10 additions and 13 deletions

View File

@ -130,14 +130,9 @@ aiScene *BaseImporter::ReadFile(Importer *pImp, const std::string &pFile, IOSyst
// passes scale into ScaleProcess
UpdateImporterScale(pImp);
} catch( const DeadlyImportError& err ) {
} catch( const std::exception &err ) {
// extract error description
m_ErrorText = err.what();
ASSIMP_LOG_ERROR(m_ErrorText.c_str());
m_Exception = std::current_exception();
return nullptr;
} catch( const std::exception& err ) {
m_ErrorText = "Internal error";
ASSIMP_LOG_ERROR(err.what());
m_Exception = std::current_exception();
return nullptr;

View File

@ -97,9 +97,8 @@ public:
/** The imported data, if ReadFile() was successful, nullptr otherwise. */
aiScene* mScene;
/** The error description, if there was one. In the case of a
* failure not caused by a DeadlyImportError, mInternalException will
* carry the full details and this will be just "Internal error". */
/** The error description, if there was one. In the case of an exception,
* mException will carry the full details. */
std::string mErrorString;
/** Any exception which occurred */

View File

@ -143,6 +143,8 @@ public:
// -------------------------------------------------------------------
/** Returns the error description of the last error that occurred.
* If the error is due to a std::exception, this will return the message.
* Exceptions can also be accessed with GetException().
* @return A description of the last error that occurred. An empty
* string if there was no error.
*/
@ -152,6 +154,8 @@ public:
// -------------------------------------------------------------------
/** Returns the exception of the last exception that occurred.
* Note: Exceptions are not the only source of error details, so GetErrorText
* should be consulted too.
* @return The last exception that occurred.
*/
const std::exception_ptr& GetException() const {
@ -419,10 +423,9 @@ private:
virtual void UpdateImporterScale(Importer *pImp);
protected:
/// Error description when a DeadlyImportError occurred during import.
/// In case of other errors, this will just be "Internal error"
/// Error description in case there was one.
std::string m_ErrorText;
/// An exception which occurred.
/// The exception, in case there was one.
std::exception_ptr m_Exception;
/// Currently set progress handler.
ProgressHandler *m_progress;

View File

@ -343,7 +343,7 @@ TEST_F(ImporterTest, stdException)
pImp->SetIOHandler(new TestIOSystem);
const aiScene* scene = pImp->ReadFile("stdException.fail", 0);
EXPECT_EQ(scene, nullptr);
EXPECT_STREQ(pImp->GetErrorString(), "Internal error");
EXPECT_STREQ(pImp->GetErrorString(), "std::exception test");
EXPECT_NE(pImp->GetException(), std::exception_ptr());
try
{