Open Lighting Architecture  Latest Git
Public Member Functions | List of all members
ola::client::Result Class Reference

Detailed Description

Indicates the result of a OLA API call.

Result objects are the first argument passed to an API callback function. They indicate if the action succeeded.

Example
void ActionCallback(const Result &result, ...) {
if (!result.Success()) {
LOG(WARN) << result.Error();
return;
}
// handle data
};

Public Member Functions

 Result (const std::string &error)
 
bool Success () const
 Indicates the status of the action. If the action failed Error() can be used to fetch the error message. More...
 
const std::string & Error () const
 Returns the error message if the action failed. More...
 

Constructor & Destructor Documentation

◆ Result()

ola::client::Result::Result ( const std::string &  error)
inlineexplicit
Parameters
errorthe text description of the error. An empty string means the action succeeded.

Member Function Documentation

◆ Error()

const std::string& ola::client::Result::Error ( ) const
inline

Returns the error message if the action failed.

Returns
the error message.

◆ Success()

bool ola::client::Result::Success ( ) const
inline

Indicates the status of the action. If the action failed Error() can be used to fetch the error message.

Returns
true if the action succeeded, false otherwise.

The documentation for this class was generated from the following file: