Skip to content

Commit c414e58

Browse files
authored
[Doc] Clarify the comments about how handleErrors works. (#65655)
1 parent 7545371 commit c414e58

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

llvm/include/llvm/Support/Error.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ErrorInfoBase {
127127
///
128128
/// auto E = foo(<...>); // <- foo returns failure with MyErrorInfo.
129129
/// auto NewE =
130-
/// handleErrors(E,
130+
/// handleErrors(std::move(E),
131131
/// [](const MyErrorInfo &M) {
132132
/// // Deal with the error.
133133
/// },
@@ -138,9 +138,15 @@ class ErrorInfoBase {
138138
/// }
139139
/// // Couldn't handle this error instance. Pass it up the stack.
140140
/// return Error(std::move(M));
141-
/// );
142-
/// // Note - we must check or return NewE in case any of the handlers
143-
/// // returned a new error.
141+
/// });
142+
/// // Note - The error passed to handleErrors will be marked as checked. If
143+
/// // there is no matched handler, a new error with the same payload is
144+
/// // created and returned.
145+
/// // The handlers take the error checked by handleErrors as an argument,
146+
/// // which can be used to retrieve more information. If a new error is
147+
/// // created by a handler, it will be passed back to the caller of
148+
/// // handleErrors and needs to be checked or return up to the stack.
149+
/// // Otherwise, the passed-in error is considered consumed.
144150
/// @endcode
145151
///
146152
/// The handleAllErrors function is identical to handleErrors, except

0 commit comments

Comments
 (0)