osm plugin: report a decent error if the .osm file is not found
This commit is contained in:
parent
dbce93669a
commit
71b281e1cc
3 changed files with 13 additions and 1 deletions
|
@ -41,6 +41,8 @@ libraries = [ 'xml2' ]
|
|||
libraries.append('curl')
|
||||
libraries.append('mapnik')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
input_plugin = plugin_env.SharedLibrary('../osm', source=osm_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include "dataset_deliverer.h"
|
||||
#include "basiccurl.h"
|
||||
#include <sstream>
|
||||
|
@ -33,6 +35,11 @@ osm_dataset* dataset_deliverer::load_from_file(const string& file, const string&
|
|||
// Only actually load from file if we haven't done so already
|
||||
if (dataset == NULL)
|
||||
{
|
||||
if (!boost::filesystem::exists(file))
|
||||
{
|
||||
throw mapnik::datasource_exception("OSM Plugin: '" + file + "' does not exist");
|
||||
}
|
||||
|
||||
dataset = new osm_dataset;
|
||||
if (dataset->load(file.c_str(), parser) == false)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
// stl
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <set>
|
||||
|
@ -91,7 +92,9 @@ void osm_datasource::bind() const
|
|||
{
|
||||
if ((osm_data_= dataset_deliverer::load_from_file(osm_filename, parser)) == NULL)
|
||||
{
|
||||
throw datasource_exception("Error loading from file");
|
||||
std::ostringstream s;
|
||||
s << "OSM Plugin: Error loading from file '" << osm_filename << "'";
|
||||
throw datasource_exception(s.str());
|
||||
}
|
||||
|
||||
do_process = true;
|
||||
|
|
Loading…
Reference in a new issue