summaryrefslogtreecommitdiff
path: root/contrib/xml/pgxml.c
diff options
context:
space:
mode:
authorTom Lane2003-07-24 17:52:50 +0000
committerTom Lane2003-07-24 17:52:50 +0000
commit8fd5b3ed67d91937516d855bd6f225052aa88f2a (patch)
tree5f14c30cb79692b6d35e612ed97feb79f62a155d /contrib/xml/pgxml.c
parentf0c5384d4a21d85198f86281f61d5754bfdca7a5 (diff)
Error message editing in contrib (mostly by Joe Conway --- thanks Joe!)
Diffstat (limited to 'contrib/xml/pgxml.c')
-rw-r--r--contrib/xml/pgxml.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/xml/pgxml.c b/contrib/xml/pgxml.c
index 682e7395b92..4d8c3b96bcf 100644
--- a/contrib/xml/pgxml.c
+++ b/contrib/xml/pgxml.c
@@ -68,7 +68,9 @@ pgxml_parse(PG_FUNCTION_ARGS)
p = XML_ParserCreate_MM(NULL, &mhs, NULL);
if (!p)
{
- elog(ERROR, "pgxml: Could not create expat parser");
+ ereport(ERROR,
+ (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+ errmsg("could not create expat parser")));
PG_RETURN_NULL(); /* seems appropriate if we couldn't parse */
}
@@ -141,7 +143,9 @@ build_xpath_results(text *doc, text *pathstr)
p = XML_ParserCreate_MM(NULL, &mhs, NULL);
if (!p)
{
- elog(ERROR, "pgxml: Could not create expat parser");
+ ereport(ERROR,
+ (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+ errmsg("could not create expat parser")));
pfree(xpr);
pfree(udata->path);
pfree(udata);
@@ -267,7 +271,7 @@ pgxml_starthandler(void *userData, const XML_Char * name,
char sepstr[] = "/";
if ((strlen(name) + strlen(UD->currentpath)) > MAXPATHLENGTH - 2)
- elog(WARNING, "Path too long");
+ elog(WARNING, "path too long");
else
{
strncat(UD->currentpath, sepstr, 1);
@@ -297,12 +301,13 @@ pgxml_endhandler(void *userData, const XML_Char * name)
sepptr = strrchr(UD->currentpath, '/');
if (sepptr == NULL)
{
- elog(ERROR, "There's a problem...");
+ /* internal error */
+ elog(ERROR, "did not find '/'");
sepptr = UD->currentpath;
}
if (strcmp(name, sepptr + 1) != 0)
{
- elog(WARNING, "Wanted [%s], got [%s]", sepptr, name);
+ elog(WARNING, "wanted [%s], got [%s]", sepptr, name);
/* unmatched entry, so do nothing */
}
else