Skip to content

Instantly share code, notes, and snippets.

@serpent7776
Created August 7, 2023 11:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
e.c
volatile MemoryContext oldcontext = CurrentMemoryContext;
PG_TRY();
{
// ...
}
PG_CATCH();
{
MemoryContext ecxt = MemoryContextSwitchTo(oldcontext);
ErrorData *edata = CopyErrorData();
// FlushErrorState(); // not needed?
MemoryContextSwitchTo(ecxt);
ereport( ERROR, ( errmsg( "An unexpected error occurred: %s", edata->message ) ) );
}
PG_END_TRY();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment