[postgis-users] Programmatically identify PostGIS errors?

Joshua Chamberlain josh at zephyri.co
Thu Feb 9 09:42:09 PST 2017


Thanks for your reply. I was hoping to find a less involved way, but if
that's what I need to do I guess I'll do it!

Thanks so much,
Joshua Chamberlain

On Wed, Feb 8, 2017 at 6:06 PM, P O'Toole <P.OToole at uwyo.edu> wrote:

> Josh
> >Hello,
> >My app allows users to write their own SQL, and I'd like to show them all
> >error messages directly pertaining to their query, while hiding system
> >errors, etc. It seems that all PostGIS errors, however, have the same
> >generic error code: XX000 Internal Error. For example:
> >SQLSTATE[XX000]: Internal error: 7 ERROR:  Operation on mixed SRID
> >geometries
> >Is there a way to identify an error as coming from PostGIS, other than
> >assuming that all internal errors are from PostGIS?
> I'm not sure there's a separate, formally-maintained list of all PostGIS
> errors your users might encounter. Your best bet is probably to look at the
> PostGIS source and see how errors are being generated there. They may or
> may not all be neatly collected in one place as opposed to being
> constructed on-the-fly. Either way, you should be able to generate a list
> of error-message formats for your installed version of PostGIS and add some
> handling logic in your application when it looks like something from
> PostGIS is bubbling.
> Cheers
> - Patrick O'Toole
> Application Developer
> Wyoming Natural Diversity Database
> UW Berry Biodiversity Conservation Center
> Department 3381, 1000 E. University Av.
> Laramie, WY 82071
> P: 307-766-3018
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170209/819ad941/attachment.html>

More information about the postgis-users mailing list