diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 1a6e1689c..f4e556c40 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -97,7 +97,7 @@ void raster_datasource::bind() const if (! boost::filesystem::exists(filename_)) throw datasource_exception("Raster Plugin: " + filename_ + " does not exist"); - + try { std::auto_ptr reader(mapnik::get_image_reader(filename_, format_)); @@ -111,11 +111,17 @@ void raster_datasource::bind() const #endif } } + catch (mapnik::image_reader_exception const& ex) + { + std::cerr << "Raster Plugin: image reader exception caught:" << ex.what() << std::endl; + throw; + } catch (...) { std::cerr << "Raster Plugin: exception caught" << std::endl; + throw; } - + is_bound_ = true; } diff --git a/plugins/input/raster/raster_featureset.cpp b/plugins/input/raster/raster_featureset.cpp index d47e48c01..3e8235de0 100644 --- a/plugins/input/raster/raster_featureset.cpp +++ b/plugins/input/raster/raster_featureset.cpp @@ -102,6 +102,10 @@ feature_ptr raster_featureset::next() } } } + catch (mapnik::image_reader_exception const& ex) + { + std::cerr << "Raster Plugin: image reader exception caught:" << ex.what() << std::endl; + } catch (...) { std::cerr << "Raster Plugin: exception caught" << std::endl; diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 09ecefaf7..6c000a023 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -97,10 +97,10 @@ void tiff_reader::init() // TODO: error handling TIFFSetWarningHandler(0); TIFF* tif = load_if_exists(file_name_); - if (!tif) return; - + if (!tif) throw image_reader_exception ("Can't load tiff file"); + char msg[1024]; - + if (TIFFRGBAImageOK(tif,msg)) { TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width_);