summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2008-06-04 17:24:08 +0000
committerJustin Bronn <jbronn@gmail.com>2008-06-04 17:24:08 +0000
commitacfc49ed4e3c1920b0fd71a7124e688eb2002a1b (patch)
tree804ad276915857fef276a4af1acf995b5ce4b0f6
parent462d731423d56d6b4a3960fd03d740255bf5a140 (diff)
gis: gdal: Made error message when opening an invalid `DataSource` more clear.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/gis/gdal/datasource.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py
index 0cc757d7a5..02363a075b 100644
--- a/django/contrib/gis/gdal/datasource.py
+++ b/django/contrib/gis/gdal/datasource.py
@@ -72,9 +72,13 @@ class DataSource(object):
if isinstance(ds_input, basestring):
# The data source driver is a void pointer.
ds_driver = c_void_p()
-
- # OGROpen will auto-detect the data source type.
- ds = open_ds(ds_input, self._write, byref(ds_driver))
+ try:
+ # OGROpen will auto-detect the data source type.
+ ds = open_ds(ds_input, self._write, byref(ds_driver))
+ except OGRException:
+ # Making the error message more clear rather than something
+ # like "Invalid pointer returned from OGROpen".
+ raise OGRException('Could not open the datasource at "%s"' % ds_input)
elif isinstance(ds_input, c_void_p) and isinstance(ds_driver, c_void_p):
ds = ds_input
else: