StatusBuilder policy to append an extra message to the original status.

Synopsis

Declared in <absl/status/status_builder.h>

class ExtraMessage;

Description

This is most useful with adaptors such as util::TaskReturn that otherwise would prevent use of operator<<. For example:

ABSL_RETURN_IF_ERROR(foo(val)) .With(absl::ExtraMessage("when calling foo()")) .With(util::TaskReturn(task));

or

ABSL_RETURN_IF_ERROR(foo(val)) .With(absl::ExtraMessage() << "val: " << val) .With(util::TaskReturn(task));

Note in the above example, the ABSL_RETURN_IF_ERROR macro ensures the ExtraMessage expression is evaluated only in the error case, so efficiency of constructing the message is not a concern in the success case.

Member Functions

Name

Description

ExtraMessage [constructor]

Constructors

operator()

Appends the accumulated extra message to builder.

operator<<

Left shift operators

Created with MrDocs