Vowpal Wabbit
Classes | Namespaces | Macros
vw_exception.h File Reference
#include <stdexcept>
#include <sstream>
#include <cstring>

Go to the source code of this file.

Classes

class  VW::vw_exception
 
class  VW::vw_argument_disagreement_exception
 
class  VW::vw_argument_invalid_value_exception
 
class  VW::vw_unrecognised_option_exception
 
class  VW::strict_parse_exception
 

Namespaces

 VW
 

Macros

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 
#define THROWERRNO(args)
 
#define THROW(args)
 
#define THROW_EX(ex, args)
 
#define VW_ASSERT(condition, args)
 
#define EXPAND(x)   x
 
#define GET_MACRO(_1, _2, NAME, ...)   NAME
 
#define THROW_OR_RETURN(...)   EXPAND(GET_MACRO(__VA_ARGS__, THROW_OR_RETURN_NORMAL, THROW_OR_RETURN_VOID, UNUSED)(__VA_ARGS__))
 
#define THROW_OR_RETURN_NORMAL(args, retval)
 
#define THROW_OR_RETURN_VOID(args)
 
#define _UNUSED(x)   ((void)(x))
 
#define DBG(x)
 

Macro Definition Documentation

◆ __FILENAME__

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

Definition at line 17 of file vw_exception.h.

◆ _UNUSED

#define _UNUSED (   x)    ((void)(x))

Definition at line 244 of file vw_exception.h.

Referenced by VW::cb_sample_data::learn_or_predict().

◆ DBG

#define DBG (   x)
Value:
do \
{ \
std::cerr << "(" << __FILENAME__ << ":" << __LINE__ << "," << __func__ << ") " << #x << ": " << x << std::endl; \
} while (0)
#define __FILENAME__
Definition: vw_exception.h:17

Definition at line 246 of file vw_exception.h.

◆ EXPAND

#define EXPAND (   x)    x

Definition at line 204 of file vw_exception.h.

◆ GET_MACRO

#define GET_MACRO (   _1,
  _2,
  NAME,
  ... 
)    NAME

Definition at line 205 of file vw_exception.h.

◆ THROW

#define THROW (   args)
Value:
{ \
std::stringstream __msg; \
__msg << args; \
throw VW::vw_exception(__FILENAME__, __LINE__, __msg.str()); \
}
#define __FILENAME__
Definition: vw_exception.h:17

Definition at line 181 of file vw_exception.h.

Referenced by Search::action_cost_loss(), active_cover_setup(), active_setup(), VW::config::options_boost_po::add_and_parse(), VW::config::options_serializer_boost_po::add_impl(), VW::config::options_boost_po::add_to_description_impl(), AllReduceSockets::all_reduce_init(), LEARNER::as_multiline(), LEARNER::as_singleline(), audit_regressor_setup(), bfgs_setup(), bin_read(), io_buf::bin_read_fixed(), bin_text_read_write_fixed_validated(), boosting_setup(), AllReduceSockets::broadcast(), cache_numbits(), cb_algs_setup(), cb_sample_setup(), CCB::ccb_explore_adf_setup(), Search::choose_policy(), classweight_setup(), v_hashmap< size_t, features >::contains(), VW::convert(), VW::config::options_boost_po::convert_to_boost_value(), CCB::convert_to_score(), cs_active_setup(), CSOAA::csldf_setup(), CB_ADF::cb_adf::do_actual_learning(), CSOAA::do_actual_learning(), do_actual_learning_ldf(), dump_regressor(), CSOAA::ec_seq_is_label_definition(), enable_sources(), LabelObjectState< audit >::EndObject(), INTERACTIONS::expand_interactions(), vw::finish_example(), gd_mf_setup(), GEN_CS::gen_cs_example(), v_hashmap< size_t, features >::get(), getHasher(), getLossFunction(), poisson_loss::getRevertingWeight(), io_buf::hash(), init_driver(), initialize_regressor(), vw::learn(), VW::vw_exception::LineNumber(), CLASSWEIGHTS::classweights::load_string(), lrq_setup(), main(), mf_predict(), mf_print_offset_features(), mf_train(), COST_SENSITIVE::name_value(), namedlabels::namedlabels(), oaa_setup(), parse_affix_argument(), parse_args(), parse_dictionary_argument(), parse_feature_tweaks(), MULTICLASS::parse_label(), CB::parse_label(), COST_SENSITIVE::parse_label(), CB_EVAL::parse_label(), CCB::parse_label(), CCB::parse_outcome(), parse_source(), AllReduceSockets::pass_down(), AllReduceSockets::pass_up(), preconditioner_to_regularizer(), GD::pred_per_update_feature(), vw::predict(), predict_bandit_adf(), CB_ALGS::predict_eval(), VW::shared_feature_merger::predict_or_learn(), predict_or_learn(), predict_or_learn_adf(), predict_or_learn_bandit_adf(), Search::read_allowed_transitions(), VW::read_line_decision_service_json(), VW::read_line_json(), AllReduceSockets::reduce(), VW::config::options_boost_po::replace(), reset_source(), resize_buf_if_needed(), VW::SpanningTree::Run(), DepParserTask::run(), save_load(), save_load_header(), GD::save_load_online_state(), GD::save_load_regressor(), scoped_calloc_or_throw(), scorer_setup(), Search::search_predict(), sensitivity(), Search::predictor::set_input_at(), Search::predictor::set_input_length(), Search::search::set_options(), GraphTask::setup(), DepParserTask::setup(), GD::setup(), Search::setup(), Search::single_prediction_notLDF(), AllReduceSockets::sock_connect(), MultiState< audit >::StartArray(), CCBOutcomeList< audit >::StartArray(), CB_ADF::test_adf_sequence(), DepParserTask::transition_eager(), DepParserTask::transition_hybrid(), VW::validate_default_bits(), VW::validate_min_max_label(), VW::validate_num_bits(), VW::validate_version(), and warm_cb_setup().

◆ THROW_EX

#define THROW_EX (   ex,
  args 
)
Value:
{ \
std::stringstream __msg; \
__msg << args; \
throw ex(__FILENAME__, __LINE__, __msg.str()); \
}
#define __FILENAME__
Definition: vw_exception.h:17

Definition at line 188 of file vw_exception.h.

Referenced by VW::config::options_boost_po::add_and_parse(), VW::config::options_boost_po::add_notifier(), VW::config::options_boost_po::check_unregistered(), and TC_parser< audit >::parserWarning().

◆ THROW_OR_RETURN

#define THROW_OR_RETURN (   ...)    EXPAND(GET_MACRO(__VA_ARGS__, THROW_OR_RETURN_NORMAL, THROW_OR_RETURN_VOID, UNUSED)(__VA_ARGS__))

◆ THROW_OR_RETURN_NORMAL

#define THROW_OR_RETURN_NORMAL (   args,
  retval 
)
Value:
do \
{ \
std::stringstream __msgA; \
__msgA << args; \
throw VW::vw_exception(__FILE__, __LINE__, __msgA.str()); \
} while (0)

Definition at line 227 of file vw_exception.h.

◆ THROW_OR_RETURN_VOID

#define THROW_OR_RETURN_VOID (   args)
Value:
do \
{ \
std::stringstream __msgB; \
__msgB << args; \
throw VW::vw_exception(__FILE__, __LINE__, __msgB.str()); \
} while (0)

Definition at line 235 of file vw_exception.h.

◆ THROWERRNO

#define THROWERRNO (   args)
Value:
{ \
std::stringstream __msg; \
__msg << args; \
char __errmsg[256]; \
if (strerror_r(errno, __errmsg, sizeof __errmsg) != 0) \
__msg << "errno = unknown"; \
else \
__msg << "errno = " << __errmsg; \
throw VW::vw_exception(__FILENAME__, __LINE__, __msg.str()); \
}
#define __FILENAME__
Definition: vw_exception.h:17

Definition at line 167 of file vw_exception.h.

Referenced by AllReduceSockets::all_reduce_init(), enable_sources(), fail_send(), AllReduceSockets::getsock(), io_buf::open_file(), open_socket(), really_read(), AllReduceSockets::reduce(), VW::SpanningTree::Run(), send_prediction(), AllReduceSockets::sock_connect(), and VW::SpanningTree::SpanningTree().

◆ VW_ASSERT

#define VW_ASSERT (   condition,
  args 
)
Value:
if (!(condition)) \
{ \
THROW(args); \
}

Definition at line 196 of file vw_exception.h.