class Status

Defined at line 18 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h

Return an object of this class from an otherwise void function to indicate

if the function executed successfully, or in the case of an error, to

provide an error message with additional detail. The message should be

worded for consumption by end-users of an application, such as to print

an error message from a command line tool, or perhaps a label field or

dialog window in a UI.

Public Methods

Status Ok ()

Return |Status::Ok()| to indicate the function did not fail.

|Status| objects are copyable and assignable, so you can create a default

|Status| and later assign a |Status::Error(with_message)|.

For example:

Status status = Status::Ok();

if (it_failed) {

status = Status::Error("It didn't work.");

}

cleanup();

return status;

Defined at line 31 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h

Status Error (const std::string & error_message)

Return |Status::Error(error_message)| to indicate the function failed,

and provide a message explaining the error, suitable for an end user.

Defined at line 35 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h

bool has_error ()

Returns |true| if constructed with a non-empty message, indicating the

outcome of the call was an error.

Defined at line 41 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h

bool ok ()

Returns |true| if constructed with no arguments, or an empty string,

indicating the function completed successfully.

Defined at line 45 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h

std::string error_message ()

Returns an non-empty string if the outcome of the call was an error.

Defined at line 48 of file ../../zircon/system/ulib/cmdline/include/lib/cmdline/status.h