Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteecd913

Browse files
committed
Improve ThrowErrorData() comments for use with soft errors.
Reviewed-by: Corey HuinkerDiscussion:https://postgr.es/m/901ab7cf01957f92ea8b30b6feeb0eacfb7505fc.camel@j-davis.com
1 parent1fed234 commiteecd913

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

‎src/backend/utils/error/elog.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,12 +1881,15 @@ FlushErrorState(void)
18811881
/*
18821882
* ThrowErrorData --- report an error described by an ErrorData structure
18831883
*
1884-
* This is somewhat like ReThrowError, but it allows elevels besides ERROR,
1885-
* and the boolean flags such as output_to_server are computed via the
1886-
* default rules rather than being copied from the given ErrorData.
1887-
* This is primarily used to re-report errors originally reported by
1888-
* background worker processes and then propagated (with or without
1889-
* modification) to the backend responsible for them.
1884+
* This function should be called on an ErrorData structure that isn't stored
1885+
* on the errordata stack and hasn't been processed yet. It will call
1886+
* errstart() and errfinish() as needed, so those should not have already been
1887+
* called.
1888+
*
1889+
* ThrowErrorData() is useful for handling soft errors. It's also useful for
1890+
* re-reporting errors originally reported by background worker processes and
1891+
* then propagated (with or without modification) to the backend responsible
1892+
* for them.
18901893
*/
18911894
void
18921895
ThrowErrorData(ErrorData*edata)

‎src/include/nodes/miscnodes.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
* After calling code that might report an error this way, check
3737
* error_occurred to see if an error happened. If so, and if details_wanted
3838
* is true, error_data has been filled with error details (stored in the
39-
* callee's memory context!). FreeErrorData() can be called to release
40-
* error_data, although that step is typically not necessary if the called
41-
* code was run in a short-lived context.
39+
* callee's memory context!). The ErrorData can be modified (e.g. downgraded
40+
* to a WARNING) and reported with ThrowErrorData(). FreeErrorData() can be
41+
* called to release error_data, although that step is typically not necessary
42+
* if the called code was run in a short-lived context.
4243
*/
4344
typedefstructErrorSaveContext
4445
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp