prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  rio warp null transformer error with bad proj4
  Currently, if you pass a bad projection, you get the following behavior:
  
  ```
  $ rio warp --dst-crs "+proj=foobar" tests/data/warp_test.tif /tmp/foo.tif
  ERROR:GDAL:CPLE_NotSupported in Failed to initialize PROJ.4 with `+proj=foobar +wktext'.
  Traceback (most recent call last):
  ...
    File "/Users/mperry/work/rasterio/rasterio/rio/warp.py", line 198, in warp
      resolution=res)
    File "/Users/mperry/work/rasterio/rasterio/warp.py", line 296, in calculate_default_transform
      left, bottom, right, top)
    File "rasterio/_warp.pyx", line 535, in rasterio._warp._calculate_default_transform (rasterio/_warp.cpp:9551)
      with InMemoryRaster(
    File "rasterio/_warp.pyx", line 542, in rasterio._warp._calculate_default_transform (rasterio/_warp.cpp:9261)
      raise ValueError("NULL transformer")
  ValueError: NULL transformer
  ```
  
  The transformer fails to initialize, which is reasonable considering the invalid proj string. Is there any way to catch that error and report back something more meaningful than "NULL transformer"?
  
  
  </issue>
  <code>
  [start of rasterio/errors.py]
  1 """A module of errors."""
  2 
  3 from click import FileError
  4 
  5 
  6 class RasterioIOError(IOError):
  7     """A failure to open a dataset using the presently registered drivers."""
  8 
  9 
  10 class RasterioDriverRegistrationError(ValueError):
  11     """To be raised when, eg, _gdal.GDALGetDriverByName("MEM") returns NULL."""
  12 
  13 
  14 class FileOverwriteError(FileError):
  15     """Rasterio's CLI refuses to implicitly clobber output files."""
  16 
  17     def __init__(self, message):
  18         super(FileOverwriteError, self).__init__('', hint=message)
  19
  [end of rasterio/errors.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/rasterio/errors.py b/rasterio/errors.py
  --- a/rasterio/errors.py
  +++ b/rasterio/errors.py
  @@ -7,7 +7,7 @@
       """A failure to open a dataset using the presently registered drivers."""
   
   
  -class RasterioDriverRegistrationError(ValueError):
  +class DriverRegistrationError(ValueError):
       """To be raised when, eg, _gdal.GDALGetDriverByName("MEM") returns NULL."""
  
verification_info: {"golden_diff": "diff --git a/rasterio/errors.py b/rasterio/errors.py\n--- a/rasterio/errors.py\n+++ b/rasterio/errors.py\n@@ -7,7 +7,7 @@\n     \"\"\"A failure to open a dataset using the presently registered drivers.\"\"\"\n \n \n-class RasterioDriverRegistrationError(ValueError):\n+class DriverRegistrationError(ValueError):\n     \"\"\"To be raised when, eg, _gdal.GDALGetDriverByName(\"MEM\") returns NULL.\"\"\"\n", "issue": "rio warp null transformer error with bad proj4\nCurrently, if you pass a bad projection, you get the following behavior:\n\n```\n$ rio warp --dst-crs \"+proj=foobar\" tests/data/warp_test.tif /tmp/foo.tif\nERROR:GDAL:CPLE_NotSupported in Failed to initialize PROJ.4 with `+proj=foobar +wktext'.\nTraceback (most recent call last):\n...\n  File \"/Users/mperry/work/rasterio/rasterio/rio/warp.py\", line 198, in warp\n    resolution=res)\n  File \"/Users/mperry/work/rasterio/rasterio/warp.py\", line 296, in calculate_default_transform\n    left, bottom, right, top)\n  File \"rasterio/_warp.pyx\", line 535, in rasterio._warp._calculate_default_transform (rasterio/_warp.cpp:9551)\n    with InMemoryRaster(\n  File \"rasterio/_warp.pyx\", line 542, in rasterio._warp._calculate_default_transform (rasterio/_warp.cpp:9261)\n    raise ValueError(\"NULL transformer\")\nValueError: NULL transformer\n```\n\nThe transformer fails to initialize, which is reasonable considering the invalid proj string. Is there any way to catch that error and report back something more meaningful than \"NULL transformer\"?\n\n", "before_files": [{"content": "\"\"\"A module of errors.\"\"\"\n\nfrom click import FileError\n\n\nclass RasterioIOError(IOError):\n    \"\"\"A failure to open a dataset using the presently registered drivers.\"\"\"\n\n\nclass RasterioDriverRegistrationError(ValueError):\n    \"\"\"To be raised when, eg, _gdal.GDALGetDriverByName(\"MEM\") returns NULL.\"\"\"\n\n\nclass FileOverwriteError(FileError):\n    \"\"\"Rasterio's CLI refuses to implicitly clobber output files.\"\"\"\n\n    def __init__(self, message):\n        super(FileOverwriteError, self).__init__('', hint=message)\n", "path": "rasterio/errors.py"}]}