#include <iostream>
#include <string>
#include <algorithm>
#include <exception>
#include <vector>
#include <cerrno>
#include "asserts.h"
#include "types.h"
Go to the source code of this file.
Classes | |
class | error_instance |
Instance of a single error containing a descriptive error message and the location in the file that the error took place. More... | |
class | error |
An error class. More... | |
Defines | |
#define | ERROR_INSTANCE(s) error_instance((s), __FILE__, __LINE__) |
#define | err_unknown INTERNAL_ERROR(0,"An unknown error has occured") |
#define | err_nomem ERROR(ENOMEM,"Out of memory") |
#define | ERROR(e, s) error(e,ERROR_INSTANCE((s)), false) |
#define | INTERNAL_ERROR(e, s) error(e,ERROR_INSTANCE(s), true) |
#define | TRY(code, es) |
#define | TRY_nomem(code) |
#define | TRY_instead(code, es) |
#define | TRY_log(code, es) |
Functions | |
std::ostream & | operator<< (std::ostream &a_out, const error &a_e) |
const char * | get_error_str (const int a_err) |
#define err_nomem ERROR(ENOMEM,"Out of memory") |
Definition at line 116 of file error.h.
Referenced by archive_manager::archive(), vault_manager::select(), error::str(), table_cell_table::table_cell_table(), and test8().
#define err_unknown INTERNAL_ERROR(0,"An unknown error has occured") |
Definition at line 114 of file error.h.
Referenced by archive_manager::archive(), configuration_manager::init(), main(), job_archiver::mf_parse_rsync_io(), mk_dirhier(), mk_relative_symlink(), job_parser::parse(), global_parser::parse(), job_parser::parse_include(), global_parser::parse_include(), global_parser::parse_include_job(), vault_manager::select(), job_archiver::start(), error::str(), test_rvm(), test_vaulter(), test_vaulter1(), test_vaulter2(), and test_vaulter3().
#define ERROR | ( | e, | |||
s | ) | error(e,ERROR_INSTANCE((s)), false) |
Definition at line 120 of file error.h.
Referenced by _signal_handler(), absolute(), timestamp::assign(), rsync_behavior::assign(), archive_path_element::assign(), estring::base(), configuration_manager::check(), job::check(), create_file(), cwd(), vault_manager::delete_oldest_archive(), report_manager::file_report(), execute::fork(), job::generate_archive_path(), job::generate_job_id(), configuration_manager::init(), log_manager::init(), make_time_string_(), job_archiver::mf_do_chores(), timer::mf_make_timer_string(), mk_absolute_path(), mk_dir(), mk_symlink(), estring::operator char const *(), estring::operator void *(), parent_pid(), job_parser::parse(), global_parser::parse(), job_parser::parse_clear(), global_parser::parse_delete_old_log_files(), global_parser::parse_delete_old_report_files(), global_parser::parse_error_logging_level(), job_parser::parse_exclude_from(), job_parser::parse_include(), global_parser::parse_include(), job_parser::parse_include_from(), global_parser::parse_include_job(), global_parser::parse_io_poll_interval(), global_parser::parse_logging_level(), job_parser::parse_rsync_connection_type(), job_parser::parse_rsync_hardlink(), job_parser::parse_rsync_multi_hardlink(), job_parser::parse_rsync_multi_hardlink_max(), job_parser::parse_rsync_options_context(), global_parser::parse_rsync_parallel(), global_parser::parse_timestamp_resolution(), global_parser::parse_vault(), global_parser::parse_vault_locking(), global_parser::parse_vault_overflow_behavior(), global_parser::parse_vault_overflow_blocks(), global_parser::parse_vault_overflow_inodes(), global_parser::parse_vault_selection_behavior(), filesystem::path(), subdirectory::path(), filestatus::path(), pid(), vault_manager::prepare(), global_parser::read_config(), configuration_manager::read_config(), job_parser::read_job(), global_parser::read_job(), configuration_manager::read_job(), rename_file(), rm_dir(), rm_file(), vault_manager::select(), timestamp::set(), table::set_cursor(), estring::T_string_to_fractional(), estring::T_string_to_integral(), test10(), test11(), test12(), test13(), test2(), test3(), and test4b().
#define ERROR_INSTANCE | ( | s | ) | error_instance((s), __FILE__, __LINE__) |
Definition at line 67 of file error.h.
Referenced by job::check(), configuration_manager::init(), job_archiver::mf_parse_rsync_io(), mk_dirhier(), mk_relative_symlink(), job_parser::parse(), global_parser::parse(), job_parser::parse_include(), global_parser::parse_include(), global_parser::parse_include_job(), error::push_back(), execute::reroute_stdio(), rm_dir(), rm_file(), vault_manager::select(), test4(), test4a(), test5(), test5a(), and test6().
#define INTERNAL_ERROR | ( | e, | |||
s | ) | error(e,ERROR_INSTANCE(s), true) |
Definition at line 123 of file error.h.
Referenced by absolute(), configuration_manager::action(), safe_num< T >::add(), archive_manager::archive(), archive_manager::archive_manager(), archive_manager::archive_path(), table::assign(), timer::bps(), catalog_manager::catalog(), catalog_manager::catalog_manager(), configuration_manager::check(), table::col_width(), configuration_manager::configuration_manager(), configuration_manager::default_file(), configuration_manager::default_job(), configuration_manager::delete_old_log_files(), configuration_manager::delete_old_report_files(), vault_manager::delete_oldest_archive(), vault_manager::deleted_archives(), safe_num< T >::divide(), timer::duration(), timer::duration_secs(), catalog_manager::erase(), vault_manager::err_deleted_archives(), configuration_manager::error_logging_level(), timer::eta(), report_manager::file_report(), job::generate_archive_path(), job::generate_job_id(), vault_manager::get_archive_list(), report_manager::init(), configuration_manager::io_poll_interval(), configuration_manager::jobs(), configuration_manager::link_catalog_dir(), configuration_manager::log_dir(), log_manager::log_manager(), configuration_manager::logging_level(), main(), table::mf_add_elt(), table::mf_remove_elt(), table::mf_remove_row(), mk_absolute_path(), safe_num< T >::multiply(), vault_manager::overflow(), reportio::parse(), vault_manager::prepare(), report_manager::print_report(), rename_file(), table::row_height(), configuration_manager::rsync_local_path(), configuration_manager::rsync_parallel(), vault_manager::select(), vault_manager::selected(), report_manager::set_total_time(), timer::started_at(), timer::stopped_at(), safe_num< T >::subtract(), test2(), test3(), test5b(), configuration_manager::timestamp(), configuration_manager::timestamp_resolution(), vault_manager::usage(), configuration_manager::use_default(), vault_manager::vault(), configuration_manager::vault_locking(), vault_manager::vault_manager(), configuration_manager::vault_overflow_behavior(), configuration_manager::vault_overflow_blocks(), configuration_manager::vault_overflow_inodes(), configuration_manager::vault_selection_behavior(), configuration_manager::vaults(), archive_manager::working_archive_path(), and log_manager::write().
#define TRY | ( | code, | |||
es | ) |
try { \ code; \ } \ catch(error e) { \ e.push_back(ERROR_INSTANCE(es)); \ throw(e); \ } \ catch(...) { \ if (errno == ENOMEM) { \ throw(err_nomem); \ } \ error e = err_unknown; \ \ e.push_back(es); \ throw(e); \ }
Definition at line 126 of file error.h.
Referenced by archive_manager::archive(), timestamp::assign(), estring::assign(), configuration_manager::check(), timer::eta(), configuration_manager::init(), timestamp::make_str_(), make_time_string_(), timer::mf_make_string(), timer::mf_make_timer_string(), estring::operator double(), estring::operator float(), estring::operator int(), estring::operator long(), estring::operator long long(), estring::operator short(), estring::operator unsigned int(), estring::operator unsigned long(), estring::operator unsigned long long(), estring::operator unsigned short(), job_parser::parse_archive_path(), job_parser::parse_clear(), global_parser::parse_delete_old_log_files(), global_parser::parse_delete_old_report_files(), job_parser::parse_exclude_from(), job_parser::parse_include_from(), global_parser::parse_include_job(), job_parser::parse_rsync_behavior(), job_parser::parse_rsync_connection_type(), job_parser::parse_rsync_hardlink(), job_parser::parse_rsync_multi_hardlink(), job_parser::parse_rsync_remote_port(), job_parser::parse_rsync_retry_count(), job_parser::parse_rsync_retry_delay(), job_parser::parse_rsync_timeout(), global_parser::parse_timestamp_resolution(), global_parser::parse_vault(), global_parser::parse_vault_locking(), global_parser::parse_vault_overflow_behavior(), global_parser::parse_vault_overflow_blocks(), global_parser::parse_vault_overflow_inodes(), global_parser::parse_vault_selection_behavior(), subdirectory::path(), percent_string(), vault_manager::prepare(), archive_path::push_back(), rm_recursive(), size_to_string(), estring::T_string_to_fractional(), and simple_lock::unlock().
#define TRY_instead | ( | code, | |||
es | ) |
try { \ code; \ } \ catch(error e) { \ e.clear_stack(); \ e.push_back(ERROR_INSTANCE(es)); \ throw(e); \ } \ catch(...) { \ if (errno == ENOMEM) { \ throw(err_nomem); \ } \ error e = err_unknown; \ \ e.push_back(es); \ throw(e); \ }
Definition at line 158 of file error.h.
Referenced by configuration_manager::check(), job_parser::parse_include(), global_parser::parse_include(), global_parser::parse_io_poll_interval(), global_parser::parse_link_catalog_dir(), global_parser::parse_log_dir(), global_parser::parse_rsync_local_path(), job_parser::parse_rsync_multi_hardlink_max(), global_parser::parse_rsync_parallel(), and global_parser::parse_vault().
#define TRY_log | ( | code, | |||
es | ) |
try { \ code; \ } \ catch(error e) { \ e.clear_stack(); \ e.push_back(ERROR_INSTANCE(es)); \ logger.write(e.str()); \ } \ catch(...) { \ if (errno == ENOMEM) { \ throw(err_nomem); \ } \ error e = err_unknown; \ \ e.push_back(es); \ logger.write(e.str()); \ }
Definition at line 177 of file error.h.
Referenced by catalog_manager::catalog().
#define TRY_nomem | ( | code | ) |
try { \ code; \ } \ catch(error e) { \ throw(e); \ } \ catch(...) { \ if (errno == ENOMEM) { \ throw(err_nomem); \ } \ throw(err_unknown); \ }
Definition at line 144 of file error.h.
Referenced by absolute(), jobs_report::add_report(), single_job_report::add_report(), vault_report::add_report(), archive_manager::archive(), timestamp::assign(), job_path_report::assign(), vault_stats_report::assign(), rsync_behavior::assign(), archive_path_element::assign(), estring::assign(), estring::base(), timer::bps(), configuration_manager::check(), job::check(), configuration_manager::clear(), filesystem::clear(), filestatus::clear(), job::common_pathname(), current_time(), cwd(), configuration_manager::default_file(), configuration_manager::default_logdir(), vault_manager::delete_oldest_archive(), timer::duration(), catalog_manager::erase(), job_path_report::error_msg(), timer::eta(), report_manager::file_report(), estring::fmt_str(), job::generate_archive_path(), job::generate_job_id(), job::generate_source_path(), single_job_report::id(), configuration_manager::init(), log_manager::init(), table::insert_col(), table::insert_row(), is_timestamp(), job_parser::location(), global_parser::location(), timestamp::make_str_(), make_time_string_(), table::mf_add_elt(), job_archiver::mf_do_chores(), timer::mf_make_string(), timer::mf_make_timer_string(), mk_absolute_path(), mk_dir(), mk_dirhier(), mk_dirhier_recursive_(), mk_relative_path(), mk_relative_symlink(), mk_symlink(), num_to_string(), filesystem::operator=(), vault_manager::overflow(), reportio::parse(), job_parser::parse(), global_parser::parse(), job_parser::parse_archive_path(), parse_basename(), job_parser::parse_clear(), global_parser::parse_default(), global_parser::parse_delete_old_log_files(), global_parser::parse_delete_old_report_files(), parse_dirname(), global_parser::parse_error_logging_level(), job_parser::parse_exclude_from(), job_parser::parse_groupname(), job_parser::parse_hostname(), job_parser::parse_include(), global_parser::parse_include(), job_parser::parse_include_from(), global_parser::parse_include_job(), global_parser::parse_io_poll_interval(), global_parser::parse_job(), job_parser::parse_jobname(), parse_line(), global_parser::parse_link_catalog_dir(), global_parser::parse_log_dir(), global_parser::parse_logging_level(), job_parser::parse_path(), job_parser::parse_rsync_behavior(), job_parser::parse_rsync_connection_type(), job_parser::parse_rsync_hardlink(), global_parser::parse_rsync_local_path(), job_parser::parse_rsync_multi_hardlink(), job_parser::parse_rsync_multi_hardlink_max(), job_parser::parse_rsync_options(), job_parser::parse_rsync_options_context(), global_parser::parse_rsync_parallel(), job_parser::parse_rsync_remote_module(), job_parser::parse_rsync_remote_path(), job_parser::parse_rsync_remote_port(), job_parser::parse_rsync_remote_user(), job_parser::parse_rsync_retry_count(), job_parser::parse_rsync_retry_delay(), job_parser::parse_rsync_timeout(), global_parser::parse_timestamp_resolution(), global_parser::parse_vault(), global_parser::parse_vault_locking(), global_parser::parse_vault_overflow_behavior(), global_parser::parse_vault_overflow_blocks(), global_parser::parse_vault_overflow_inodes(), global_parser::parse_vault_selection_behavior(), filesystem::path(), directory::path(), subdirectory::path(), filestatus::path(), path_basename(), path_dirname(), percent_string(), permute_path(), vault_manager::prepare(), print_help(), archive_path::push_back(), global_parser::read_config(), configuration_manager::read_config(), job_parser::read_job(), global_parser::read_job(), configuration_manager::read_job(), reform_path(), rename_file(), rsync_behavior::reset(), table::resize(), rm_dir(), rm_file(), rm_recursive(), rstat::rstat(), vault_manager::select(), size_to_string(), job_path_report::source(), stamp(), timer::started_at(), timer::stopped_at(), timestamp::str(), archive_path::str(), archive_path_element::str(), estring::T_fraction_to_strings(), estring::T_integral_to_string(), estring::T_string_to_fractional(), estring::T_string_to_integral(), estring::T_string_to_signed_integral(), table::table(), throughput_to_string(), job_path_report::time(), and simple_lock::unlock().
const char* get_error_str | ( | const int | a_err | ) |
Definition at line 389 of file error.cc.
Referenced by global_parser::parse_vault(), and error::push_back().
std::ostream& operator<< | ( | std::ostream & | a_out, | |
const error & | a_e | |||
) |
Definition at line 384 of file error.cc.
References error::write().