mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Add an errdetail_internal() ereport auxiliary routine.
This function supports untranslated detail messages, in the same way that errmsg_internal supports untranslated primary messages. We've needed this for some time IMO, but discussion of some cases in the SSI code provided the impetus to actually add it. Kevin Grittner, with minor adjustments by me
This commit is contained in:
@ -842,6 +842,33 @@ errdetail(const char *fmt,...)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* errdetail_internal --- add a detail error message text to the current error
|
||||
*
|
||||
* This is exactly like errdetail() except that strings passed to
|
||||
* errdetail_internal are not translated, and are customarily left out of the
|
||||
* internationalization message dictionary. This should be used for detail
|
||||
* messages that seem not worth translating for one reason or another
|
||||
* (typically, that they don't seem to be useful to average users).
|
||||
*/
|
||||
int
|
||||
errdetail_internal(const char *fmt,...)
|
||||
{
|
||||
ErrorData *edata = &errordata[errordata_stack_depth];
|
||||
MemoryContext oldcontext;
|
||||
|
||||
recursion_depth++;
|
||||
CHECK_STACK_DEPTH();
|
||||
oldcontext = MemoryContextSwitchTo(ErrorContext);
|
||||
|
||||
EVALUATE_MESSAGE(detail, false, false);
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
recursion_depth--;
|
||||
return 0; /* return value does not matter */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* errdetail_log --- add a detail_log error message text to the current error
|
||||
*/
|
||||
|
@ -146,6 +146,12 @@ errdetail(const char *fmt,...)
|
||||
the supplied arguments. */
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
|
||||
extern int
|
||||
errdetail_internal(const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string for consistency with
|
||||
the supplied arguments. */
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
|
||||
extern int
|
||||
errdetail_log(const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string for consistency with
|
||||
|
Reference in New Issue
Block a user