C++ YT Wrapper
C++ library for working with YT clusters
Loading...
Searching...
No Matches
NYT::TYtError Class Reference

Error returned by YT cluster. More...

#include <errors.h>

Public Member Functions

 TYtError ()
 Constructs error with NYT::NClusterErrorCodes::OK code and empty message.
 TYtError (const TString &message)
 Constructs error with NYT::NClusterErrorCodes::Generic code and given message.
 TYtError (int code, TString message, TVector< TYtError > inner={}, TNode::TMapType attributes={})
 Constructs error from given parameters.
 TYtError (const ::NJson::TJsonValue &value)
 Construct error from json representation.
 TYtError (const TNode &value)
 Construct error from TNode representation.
bool ContainsErrorCode (int code) const
 Check if error or any of inner errors has given error code.
TString ShortDescription () const
 Get short description of error.
TString FullDescription () const
 Get full description of error.
int GetCode () const
 Get error code of the topmost error.
const TString & GetMessage () const
 Get error text of the topmost error.
bool ContainsText (const TStringBuf &text) const
 Check if error or any of inner errors contains given text chunk.
const TVector< TYtError > & InnerErrors () const
 Get inner errors.
void ParseFrom (TStringBuf jsonError)
 Parse error from json string.
TSet< int > GetAllErrorCodes () const
 Collect error codes from entire error tree.
bool HasAttributes () const
 Check if error has any attributes.
const TNode::TMapType & GetAttributes () const
 Get error attributes.
TString GetYsonText () const
 Get text yson representation of error.

Detailed Description

Error returned by YT cluster.

An object of this class describe error that happened on YT server. Internally each error is a tree. Each node of the tree contains:

  • integer error code;
  • text description of error;
  • attributes describing error context.

To get text description of an error one should use NYT::TYtError::ShortDescription or NYT::TYtError::FullDescription

To distinguish between error kinds NYT::TYtError::ContainsErrorCode should be used.

See also
NYT::TErrorResponse
NYT::TOperationFailedError

Member Function Documentation

◆ ContainsErrorCode()

bool NYT::TYtError::ContainsErrorCode ( int code) const

Check if error or any of inner errors has given error code.

Use this method to distinguish kind of error.

◆ ContainsText()

bool NYT::TYtError::ContainsText ( const TStringBuf & text) const

Check if error or any of inner errors contains given text chunk.

Warning
NYT::TYtError::ContainsErrorCode must be used instead of this method when possible. If there is no suitable error code it's better to ask yt@ to add one. This method should only be used as workaround.

◆ FullDescription()

TString NYT::TYtError::FullDescription ( ) const

Get full description of error.

Full description contains readable short description followed by text yson representation of error that contains error codes and attributes.

◆ GetCode()

int NYT::TYtError::GetCode ( ) const

Get error code of the topmost error.

Warning
Do not use this method to distinguish between error kinds NYT::TYtError::ContainsErrorCode should be used instead.

◆ GetMessage()

const TString & NYT::TYtError::GetMessage ( ) const

Get error text of the topmost error.

Warning
This method should not be used to log errors since text description of inner errors is going to be lost. NYT::TYtError::FullDescription should be used instead.

◆ ShortDescription()

TString NYT::TYtError::ShortDescription ( ) const

Get short description of error.

Short description contain text description of error and all inner errors. It is human readable but misses some important information (error codes, error attributes).

Usually it's better to use NYT::TYtError::FullDescription to log errors.


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