diff --git a/modules/gui/src/file_loader.cc b/modules/gui/src/file_loader.cc index ffce1169b7a0e40e6800f3ec743eb18417dd97be..e6d8ab220ba2c605f5a77614da7149bd0bb04d35 100644 --- a/modules/gui/src/file_loader.cc +++ b/modules/gui/src/file_loader.cc @@ -82,7 +82,7 @@ void FileLoader::LoadObject(const QString& file_name) if (!obj) { try{ obj=FileLoader::TryLoadMap(file_name); - } catch (io::IOException&) { + } catch (io::IOUnknownFormatException&) { return; } } @@ -178,7 +178,7 @@ gfx::GfxObjP FileLoader::TryLoadEntity(const QString& file_name, io::EntityIOHan try{ handler = io::IOManager::Instance().FindEntityImportHandler(file_name.toStdString()); } - catch(io::IOException e){ + catch(io::IOUnknownFormatException e){ handler = io::EntityIOHandlerP(); } } @@ -211,13 +211,13 @@ gfx::GfxObjP FileLoader::TryLoadEntity(const QString& file_name, io::EntityIOHan } #if OST_IMG_ENABLED -gfx::GfxObjP FileLoader::TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler) throw(io::IOException) +gfx::GfxObjP FileLoader::TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler) throw(io::IOException,io::IOUnknownFormatException) { if(!handler){ try{ handler = io::IOManager::Instance().FindMapImportHandlerFile(filename.toStdString(),io::UndefinedImageFormat()); } - catch(io::IOException e){ + catch(io::IOUnknownFormatException e){ handler = io::MapIOHandlerPtr(); } } @@ -258,7 +258,7 @@ gfx::GfxObjP FileLoader::TryLoadSurface(const QString& filename, io::SurfaceIOHa try{ handler = io::IOManager::Instance().FindSurfaceImportHandler(filename.toStdString(),"msms"); } - catch(io::IOException e){ + catch(io::IOUnknownFormatException e){ handler = io::SurfaceIOHandlerPtr(); } } diff --git a/modules/gui/src/file_loader.hh b/modules/gui/src/file_loader.hh index fa158ff456920cc59af0ee420f7df0fa63aadaa1..06b4f237f9c4b25ecb739e8766753c330d339d95 100644 --- a/modules/gui/src/file_loader.hh +++ b/modules/gui/src/file_loader.hh @@ -45,7 +45,7 @@ private: static void HandleError(Message m, gfx::GfxObjP obj); static gfx::GfxObjP TryLoadEntity(const QString& file_name, io::EntityIOHandlerP handler=io::EntityIOHandlerP()); #if OST_IMG_ENABLED - static gfx::GfxObjP TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler=io::MapIOHandlerPtr()) throw(io::IOException); + static gfx::GfxObjP TryLoadMap(const QString& filename, io::MapIOHandlerPtr handler=io::MapIOHandlerPtr()) throw(io::IOException,io::IOUnknownFormatException); #endif static gfx::GfxObjP TryLoadSurface(const QString& filename, io::SurfaceIOHandlerPtr handler=io::SurfaceIOHandlerPtr()); static void RunScript(const QString& filename); diff --git a/modules/io/src/img/load_map.cc b/modules/io/src/img/load_map.cc index 8d0ce47e12591c070a77e145df8bc7ee7ced3265..f700d37368aef23e6c0570bfdb8bf732b7447392 100644 --- a/modules/io/src/img/load_map.cc +++ b/modules/io/src/img/load_map.cc @@ -44,7 +44,7 @@ DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path& loc, MapIOHandlerPtr map_io = IOManager::Instance().FindMapImportHandlerFile(loc,formatstruct); if(!map_io) { - throw IOException("could not find io-plugin for " + loc.string()); + throw IOUnknownFormatException("could not find io-plugin for " + loc.string()); } img::ImageHandle ih = CreateImage(img::Extent(),img::REAL,img::SPATIAL); @@ -70,7 +70,7 @@ DLLEXPORT_OST_IO void SaveImage(const img::ImageHandle& image, const boost::file MapIOHandlerPtr map_io = IOManager::Instance().FindMapExportHandlerFile(loc,formatstruct); if(!map_io) { - throw IOException("could not find io-plugin for " + loc.string()); + throw IOUnknownFormatException("could not find io-plugin for " + loc.string()); } LOG_DUMP("calling export on map io handle" << std::endl); map_io->Export(image, loc,formatstruct); diff --git a/modules/io/src/io_manager.cc b/modules/io/src/io_manager.cc index 88451aeed283e0ab984ac3fca1c143d33f0d7ddf..23ab54bd29a2bc3efe72085ac9f9242b80c7a69f 100644 --- a/modules/io/src/io_manager.cc +++ b/modules/io/src/io_manager.cc @@ -77,7 +77,7 @@ EntityIOHandlerP IOManager::FindEntityImportHandler(const String& filename, } } - throw IOException("no suitable entity io handler found for "+filename); + throw IOUnknownFormatException("no suitable entity io handler found for "+filename); } EntityIOHandlerP IOManager::FindEntityExportHandler(const String& filename, @@ -89,7 +89,7 @@ EntityIOHandlerP IOManager::FindEntityExportHandler(const String& filename, return (*it)->Create(); } } - throw IOException("no suitable handler found for "+filename); + throw IOUnknownFormatException("no suitable handler found for "+filename); } SequenceIOHandlerPtr IOManager::FindAlignmentImportHandler(const String& filename, @@ -100,7 +100,7 @@ SequenceIOHandlerPtr IOManager::FindAlignmentImportHandler(const String& filenam return (*it)->Create(); } } - throw IOException("no suitable alignment io handler found for "+filename); + throw IOUnknownFormatException("no suitable alignment io handler found for "+filename); } SequenceIOHandlerPtr IOManager::FindAlignmentExportHandler(const String& filename, @@ -112,7 +112,7 @@ SequenceIOHandlerPtr IOManager::FindAlignmentExportHandler(const String& filenam return (*it)->Create(); } } - throw IOException("no suitable alignment io handler found for "+filename); + throw IOUnknownFormatException("no suitable alignment io handler found for "+filename); } SurfaceIOHandlerPtr IOManager::FindSurfaceImportHandler(const String& filename, @@ -125,7 +125,7 @@ SurfaceIOHandlerPtr IOManager::FindSurfaceImportHandler(const String& filename, } } - throw IOException("no suitable surface io handler found for "+filename); + throw IOUnknownFormatException("no suitable surface io handler found for "+filename); } #if OST_IMG_ENABLED @@ -138,7 +138,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerFile(const boost::filesystem::pat return (*it)->Create(); } } - throw IOException("Unsupported type in FindMapImportHandle."); + throw IOUnknownFormatException("Unsupported type in FindMapImportHandle."); }else{ String match_suf_string=loc.string(); std::transform(match_suf_string.begin(),match_suf_string.end(),match_suf_string.begin(),tolower); @@ -161,7 +161,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerFile(const boost::filesystem::pat return (*it)->Create(); } } - throw IOException("No file suffix given for " + loc.string()+", and could not detect automatically, please indicate file type."); + throw IOUnknownFormatException("No file suffix given for " + loc.string()+", and could not detect automatically, please indicate file type."); } return MapIOHandlerPtr(); // removes warning } @@ -175,7 +175,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerStream(std::istream& stream, return (*it)->Create();; } } - throw IOException("Unsuspported type in FindMapImportHandle."); + throw IOUnknownFormatException("Unsuspported type in FindMapImportHandle."); }else{ unsigned char header[256]; stream.read(reinterpret_cast<char*>(&header),256); @@ -186,7 +186,7 @@ MapIOHandlerPtr IOManager::FindMapImportHandlerStream(std::istream& stream, return (*it)->Create();; } } - throw IOException("No type given for stream, and could not detect automatically, please indicate file type."); + throw IOUnknownFormatException("No type given for stream, and could not detect automatically, please indicate file type."); } return MapIOHandlerPtr(); //removes warning } @@ -200,12 +200,12 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerFile(const boost::filesystem::pat return (*it)->Create(); } } - throw IOException("Unsupported type in FindMapExportHandle."); + throw IOUnknownFormatException("Unsupported type in FindMapExportHandle."); }else{ String filename=loc.string(); String::size_type pos = filename.rfind("."); if (pos == String::npos){ - throw IOException("No file suffix given for " + filename+", please indicate file type."); + throw IOUnknownFormatException("No file suffix given for " + filename+", please indicate file type."); } String match_suf_string=loc.string(); std::transform(match_suf_string.begin(),match_suf_string.end(),match_suf_string.begin(),tolower); @@ -214,7 +214,7 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerFile(const boost::filesystem::pat return(*it)->Create(); } } - throw IOException("could not find io-plugin for " + filename); + throw IOUnknownFormatException("could not find io-plugin for " + filename); } return MapIOHandlerPtr(); // removes the warning } @@ -227,9 +227,9 @@ MapIOHandlerPtr IOManager::FindMapExportHandlerStream(std::istream& stream, cons return (*it)->Create(); } } - throw IOException("Unsupported type in FindMapExportHandlerStream"); + throw IOUnknownFormatException("Unsupported type in FindMapExportHandlerStream"); } else { - throw IOException("No type given. Please indicate stream type"); + throw IOUnknownFormatException("No type given. Please indicate stream type"); } return MapIOHandlerPtr(); // removes the warning } diff --git a/modules/io/src/mol/save_entity.cc b/modules/io/src/mol/save_entity.cc index d5a4f48e1bf826d7b3e5e5865e6ed873894684dc..0bfadfc0b0a917a301dff6e3ab774e8601e37529 100644 --- a/modules/io/src/mol/save_entity.cc +++ b/modules/io/src/mol/save_entity.cc @@ -36,7 +36,7 @@ void DLLEXPORT_OST_IO SaveEntity(const mol::EntityView& en, EntityIOHandlerP ent_io=manager.FindEntityExportHandler(filename, format); if (!ent_io) { - throw IOException("No IO handler for file='"+filename+"', format='"+ + throw IOUnknownFormatException("No IO handler for file='"+filename+"', format='"+ format+"' found."); } LOG_DUMP("calling export on entity io handle" << std::endl);