Google APIs Client Library for C++
Status Class Reference

namespace error More...

#include "util/status.h"

List of all members.

Public Member Functions

 Status ()
 Constructs a default OK status.
 Status (googleapis::util::error::Code code, const StringPiece &msg)
 Constructs a status with the given code and message.
 Status (const Status &status)
 Copy constructor.
 ~Status ()
 Standard destructor.
Statusoperator= (const Status &status)
 Assignment operator.
bool operator== (const Status &status) const
 Equality operator.
bool ok () const
 Determine if the status is ok().
const string & error_message () const
 Get explanation bound at construction.
googleapis::util::error::Code error_code () const
 Get error_code bound at construction.
string ToString () const
 Convert the status to a detailed string.
void IgnoreError () const
 This method is a NOP that confirms we are ignoring a status.

Detailed Description

namespace error

Denotes whether a call or object is error free, and explains why if not.

Status objects are used through the Google APIs Client Library for C++ to return and propagate errors rather than using C++ exceptions. They are simple data objects that support copy and assignment so that they can propagate across scopes and out of dynamic objects that may be destroyed before the error is propagated.

If the status is not ok() then the code() and error_message() will indicate why.


Constructor & Destructor Documentation

Status ( ) [inline]

Constructs a default OK status.

Status ( googleapis::util::error::Code  code,
const StringPiece &  msg 
) [inline]

Constructs a status with the given code and message.

Parameters:
[in]codeThe status code for the instance.
[in]msgIf the code is other than OK then this should not be empty.
Status ( const Status status) [inline]

Copy constructor.

~Status ( ) [inline]

Standard destructor.


Member Function Documentation

Get error_code bound at construction.

const string& error_message ( ) const [inline]

Get explanation bound at construction.

void IgnoreError ( ) const [inline]

This method is a NOP that confirms we are ignoring a status.

bool ok ( ) const [inline]

Determine if the status is ok().

Returns:
true if the error code is OK, false otherwise.
Status& operator= ( const Status status) [inline]

Assignment operator.

bool operator== ( const Status status) const [inline]

Equality operator.

string ToString ( ) const

Convert the status to a detailed string.

If displaying the error to a user than error_message might be preferred since it has less technical jargon.

See also:
error_message()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines