Skip to content

Commit

Permalink
Make authority exception more informative.
Browse files Browse the repository at this point in the history
Co-Authored-By: Joris Van den Bossche <jorisvandenbossche@gmail.com>
  • Loading branch information
snowman2 and jorisvandenbossche committed May 11, 2019
1 parent 59b062f commit 6803ba2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pyproj/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ cdef class Ellipsoid(Base):
PJ_CATEGORY_ELLIPSOID,
)
if ellipsoid_pj == NULL:
raise CRSError("Invalid authority")
raise CRSError(
"Invalid authority or code ({0}, {1})".format(auth_name, code)
)
return Ellipsoid.create(ellipsoid_pj)

@staticmethod
Expand Down Expand Up @@ -584,7 +586,9 @@ cdef class PrimeMeridian(Base):
PJ_CATEGORY_PRIME_MERIDIAN,
)
if prime_meridian_pj == NULL:
raise CRSError("Invalid authority")
raise CRSError(
"Invalid authority or code ({0}, {1})".format(auth_name, code)
)
return PrimeMeridian.create(prime_meridian_pj)

@staticmethod
Expand Down Expand Up @@ -648,7 +652,9 @@ cdef class Datum(Base):
PJ_CATEGORY_DATUM,
)
if datum_pj == NULL:
raise CRSError("Invalid authority")
raise CRSError(
"Invalid authority or code ({0}, {1})".format(auth_name, code)
)
return Datum.create(datum_pj)

@staticmethod
Expand Down Expand Up @@ -969,7 +975,9 @@ cdef class CoordinateOperation(Base):
use_proj_alternative_grid_names,
)
if coord_operation_pj == NULL:
raise CRSError("Invalid authority")
raise CRSError(
"Invalid authority or code ({0}, {1})".format(auth_name, code)
)
return CoordinateOperation.create(coord_operation_pj)

@staticmethod
Expand Down

0 comments on commit 6803ba2

Please sign in to comment.