Actually, just keep the old behaviour for now.
parent
9b5e758bdd
commit
8f893e3653
|
@ -130,14 +130,9 @@ aiScene *BaseImporter::ReadFile(Importer *pImp, const std::string &pFile, IOSyst
|
||||||
// passes scale into ScaleProcess
|
// passes scale into ScaleProcess
|
||||||
UpdateImporterScale(pImp);
|
UpdateImporterScale(pImp);
|
||||||
|
|
||||||
} catch( const DeadlyImportError& err ) {
|
} catch( const std::exception &err ) {
|
||||||
// extract error description
|
// extract error description
|
||||||
m_ErrorText = err.what();
|
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());
|
ASSIMP_LOG_ERROR(err.what());
|
||||||
m_Exception = std::current_exception();
|
m_Exception = std::current_exception();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -97,9 +97,8 @@ public:
|
||||||
/** The imported data, if ReadFile() was successful, nullptr otherwise. */
|
/** The imported data, if ReadFile() was successful, nullptr otherwise. */
|
||||||
aiScene* mScene;
|
aiScene* mScene;
|
||||||
|
|
||||||
/** The error description, if there was one. In the case of a
|
/** The error description, if there was one. In the case of an exception,
|
||||||
* failure not caused by a DeadlyImportError, mInternalException will
|
* mException will carry the full details. */
|
||||||
* carry the full details and this will be just "Internal error". */
|
|
||||||
std::string mErrorString;
|
std::string mErrorString;
|
||||||
|
|
||||||
/** Any exception which occurred */
|
/** Any exception which occurred */
|
||||||
|
|
|
@ -143,6 +143,8 @@ public:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns the error description of the last error that occurred.
|
/** 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
|
* @return A description of the last error that occurred. An empty
|
||||||
* string if there was no error.
|
* string if there was no error.
|
||||||
*/
|
*/
|
||||||
|
@ -152,6 +154,8 @@ public:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns the exception of the last exception that occurred.
|
/** 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.
|
* @return The last exception that occurred.
|
||||||
*/
|
*/
|
||||||
const std::exception_ptr& GetException() const {
|
const std::exception_ptr& GetException() const {
|
||||||
|
@ -419,10 +423,9 @@ private:
|
||||||
virtual void UpdateImporterScale(Importer *pImp);
|
virtual void UpdateImporterScale(Importer *pImp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Error description when a DeadlyImportError occurred during import.
|
/// Error description in case there was one.
|
||||||
/// In case of other errors, this will just be "Internal error"
|
|
||||||
std::string m_ErrorText;
|
std::string m_ErrorText;
|
||||||
/// An exception which occurred.
|
/// The exception, in case there was one.
|
||||||
std::exception_ptr m_Exception;
|
std::exception_ptr m_Exception;
|
||||||
/// Currently set progress handler.
|
/// Currently set progress handler.
|
||||||
ProgressHandler *m_progress;
|
ProgressHandler *m_progress;
|
||||||
|
|
|
@ -343,7 +343,7 @@ TEST_F(ImporterTest, stdException)
|
||||||
pImp->SetIOHandler(new TestIOSystem);
|
pImp->SetIOHandler(new TestIOSystem);
|
||||||
const aiScene* scene = pImp->ReadFile("stdException.fail", 0);
|
const aiScene* scene = pImp->ReadFile("stdException.fail", 0);
|
||||||
EXPECT_EQ(scene, nullptr);
|
EXPECT_EQ(scene, nullptr);
|
||||||
EXPECT_STREQ(pImp->GetErrorString(), "Internal error");
|
EXPECT_STREQ(pImp->GetErrorString(), "std::exception test");
|
||||||
EXPECT_NE(pImp->GetException(), std::exception_ptr());
|
EXPECT_NE(pImp->GetException(), std::exception_ptr());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue