mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Add errhint_plural() function and make use of it
Similar to existing errmsg_plural() and errdetail_plural(). Some errhint() calls hadn't received the proper plural treatment yet.
This commit is contained in:
@@ -1166,6 +1166,29 @@ errhint(const char *fmt,...)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* errhint_plural --- add a hint error message text to the current error,
|
||||
* with support for pluralization of the message text
|
||||
*/
|
||||
int
|
||||
errhint_plural(const char *fmt_singular, const char *fmt_plural,
|
||||
unsigned long n,...)
|
||||
{
|
||||
ErrorData *edata = &errordata[errordata_stack_depth];
|
||||
MemoryContext oldcontext;
|
||||
|
||||
recursion_depth++;
|
||||
CHECK_STACK_DEPTH();
|
||||
oldcontext = MemoryContextSwitchTo(edata->assoc_context);
|
||||
|
||||
EVALUATE_MESSAGE_PLURAL(edata->domain, hint, false);
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
recursion_depth--;
|
||||
return 0; /* return value does not matter */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* errcontext_msg --- add a context error message text to the current error
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user