Show
Ignore:
Timestamp:
11/16/09 17:09:50 (5 years ago)
Author:
robert
Message:

Replaced catch usage

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/stl/ReaderWriterSTL.cpp

    r10469 r10759  
    138138      } 
    139139    } 
     140     
     141    const std::string& getErrorString() const { return m_ErrorString; } 
     142     
    140143  private: 
    141144    int counter; 
     
    143146    std::string m_fout; 
    144147    osgDB::ReaderWriter::Options const * m_options; 
     148    std::string m_ErrorString; 
    145149     
    146150     
     
    464468osgDB::ReaderWriter::WriteResult ReaderWriterSTL::writeNode(const osg::Node& node,const std::string& fileName, const Options* opts) const 
    465469{ 
    466   if (fileName.empty()) return WriteResult::FILE_NOT_HANDLED; 
    467  
    468   std::string ext = osgDB::getLowerCaseFileExtension(fileName); 
    469   if (ext != "stl" ) 
    470   { 
    471     // sta - extension implies STL-Binary... 
    472     osg::notify(osg::INFO) << "ReaderWriterSTL::writeNode: Only STL-ASCII-files supported'" << std::endl; 
    473     return WriteResult::FILE_NOT_HANDLED; 
    474   } 
     470    if (fileName.empty()) return WriteResult::FILE_NOT_HANDLED; 
     471 
     472    std::string ext = osgDB::getLowerCaseFileExtension(fileName); 
     473    if (ext != "stl" ) 
     474    { 
     475        // sta - extension implies STL-Binary... 
     476        osg::notify(osg::INFO) << "ReaderWriterSTL::writeNode: Only STL-ASCII-files supported'" << std::endl; 
     477        return WriteResult::FILE_NOT_HANDLED; 
     478    } 
    475479   
    476   try { 
    477480    CreateStlVisitor createStlVisitor( fileName, opts ); 
    478481    const_cast<osg::Node&>(node).accept( createStlVisitor ); 
    479   } catch(...) { 
    480     return WriteResult::ERROR_IN_WRITING_FILE; 
    481   } 
    482    
    483   return WriteResult::FILE_SAVED; 
     482 
     483    if (createStlVisitor.getErrorString().empty()) 
     484    { 
     485        return WriteResult::FILE_SAVED; 
     486    } 
     487    else 
     488    { 
     489        osg::notify(osg::NOTICE)<<"Error: "<<createStlVisitor.getErrorString()<<std::endl; 
     490        return WriteResult::ERROR_IN_WRITING_FILE; 
     491    } 
    484492}