Vowpal Wabbit
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
api_status.h File Reference
#include <sstream>
#include <string>

Classes

class  VW::experimental::api_status
 Report status of all API calls. More...
 
class  VW::experimental::status_builder
 Helper class used in report_error template funcstions to return status from API calls. More...
 

Namespaces

namespace  VW
 
namespace  VW::experimental
 

Macros

#define RETURN_ERROR(status, code, ...)
 Error reporting macro for just returning an error code. More...
 
#define RETURN_ERROR_ARG(status, code, ...)
 Error reporting macro that takes a list of parameters. More...
 
#define RETURN_ERROR_LS(status, code)
 Error reporting macro used with left shift operator. More...
 
#define RETURN_IF_FAIL(x)
 Error reporting macro to test and return on error. More...
 

Typedefs

using VW::experimental::i_trace = void
 

Functions

template<typename Last >
void VW::experimental::report_error (std::ostringstream &os, const Last &last)
 Ends recursion of report_error variadic template with the Last argument. More...
 
template<typename First , typename... Rest>
void VW::experimental::report_error (std::ostringstream &os, const First &first, const Rest &... rest)
 Begins recursion of report_error variadic template with ostringstream to serialize error information. More...
 
template<typename... All>
int VW::experimental::report_error (api_status *status, int scode, const All &... all)
 The main report_error template used to serialize error into api_status The method most end users will use with a status code and a number of objects to be serialised into an api_status. More...
 
template<typename T >
VW::experimental::status_builderVW::experimental::operator<< (VW::experimental::status_builder &sb, const T &val)
 left shift operator to serialize types into stringstream held in status_builder More...
 
int VW::experimental::report_error (status_builder &sb)
 Terminates recursion of report_error. More...
 
template<typename Last >
int VW::experimental::report_error (status_builder &sb, const Last &last)
 report_error that takes the final paramter More...
 
template<typename First , typename... Rest>
int VW::experimental::report_error (status_builder &sb, const First &first, const Rest &... rest)
 variadic template report_error that takes a list of parameters More...
 

Macro Definition Documentation

◆ RETURN_ERROR

#define RETURN_ERROR (   status,
  code,
  ... 
)
Value:
do { \
if (status != nullptr) \
{ \
VW::experimental::status_builder sb(nullptr, status, VW::experimental::error_code::code); \
sb << VW::experimental::error_code::code##_s; \
return report_error(sb); \
} \
return VW::experimental::error_code::code; \
} while (0);
Helper class used in report_error template funcstions to return status from API calls.
Definition: api_status.h:69

Error reporting macro for just returning an error code.

◆ RETURN_ERROR_ARG

#define RETURN_ERROR_ARG (   status,
  code,
  ... 
)
Value:
do { \
if (status != nullptr) \
{ \
VW::experimental::status_builder sb(nullptr, status, VW::experimental::error_code::code); \
sb << VW::experimental::error_code::code##_s; \
return report_error(sb, __VA_ARGS__); \
} \
return VW::experimental::error_code::code; \
} while (0);

Error reporting macro that takes a list of parameters.

◆ RETURN_ERROR_LS

#define RETURN_ERROR_LS (   status,
  code 
)
Value:
VW::experimental::status_builder sb(nullptr, status, VW::experimental::error_code::code); \
return sb << VW::experimental::error_code::code##_s

Error reporting macro used with left shift operator.

◆ RETURN_IF_FAIL

#define RETURN_IF_FAIL (   x)
Value:
do { \
int retval__LINE__ = (x); \
if (retval__LINE__ != 0) { return retval__LINE__; } \
} while (0)

Error reporting macro to test and return on error.