error.h File Reference

#include <iostream>
#include <string>
#include <algorithm>
#include <exception>
#include <vector>
#include <cerrno>
#include "asserts.h"
#include "types.h"

Include dependency graph for error.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

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 Documentation

#define err_nomem   ERROR(ENOMEM,"Out of memory")
 

Definition at line 115 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 113 of file error.h.

Referenced by archive_manager::archive(), main(), job_archiver::mf_parse_rsync_io(), mk_dirhier(), mk_relative_symlink(), vault_manager::select(), job_archiver::start(), error::str(), test_rvm(), and test_vaulter().

#define ERROR e,
 )     error(e,ERROR_INSTANCE((s)), false)
 

Definition at line 119 of file error.h.

Referenced by _signal_handler(), 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(), log_manager::init(), make_time_string_(), timer::mf_make_timer_string(), mk_absolute_path(), mk_dir(), mk_symlink(), estring::operator char *(), estring::operator void *(), parent_pid(), job_parser::parse_exclude_from(), job_parser::parse_include(), global_parser::parse_include(), job_parser::parse_include_from(), global_parser::parse_include_job(), job_parser::parse_rsync_options_context(), 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(), test2(), test3(), and test4b().

#define ERROR_INSTANCE  )     error_instance((s), __FILE__, __LINE__)
 

Definition at line 67 of file error.h.

Referenced by job_archiver::mf_parse_rsync_io(), mk_dirhier(), mk_relative_symlink(), error::push_back(), execute::reroute_stdio(), test4(), test4a(), test5(), test5a(), and test6().

#define INTERNAL_ERROR e,
 )     error(e,ERROR_INSTANCE(s), true)
 

Definition at line 122 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(), table::col_width(), configuration_manager::default_file(), configuration_manager::default_job(), configuration_manager::default_logdir(), 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(), timer::eta(), report_manager::file_report(), job::generate_archive_path(), vault_manager::get_archive_list(), report_manager::init(), configuration_manager::initialized(), configuration_manager::io_poll_interval(), configuration_manager::jobs(), configuration_manager::link_catalog_dir(), configuration_manager::log_dir(), log_manager::log_manager(), 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(), vault_manager::vault(), 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   ) 
 

Value:

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 125 of file error.h.

Referenced by archive_manager::archive(), timestamp::assign(), estring::assign(), timer::eta(), 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(), subdirectory::path(), percent_string(), vault_manager::prepare(), archive_path::push_back(), rm_recursive(), size_to_string(), estring::T_string_to_fractional(), and test7a().

#define TRY_instead code,
es   ) 
 

Value:

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 157 of file error.h.

#define TRY_log code,
es   ) 
 

Value:

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 176 of file error.h.

Referenced by catalog_manager::catalog().

#define TRY_nomem code   ) 
 

Value:

try { \
                code; \
        } \
        catch(error e) { \
                throw(e); \
        } \
        catch(...) { \
                if (errno == ENOMEM) { \
                        throw(err_nomem); \
                } \
                throw(err_unknown); \
        }

Definition at line 143 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(), job::check(), filesystem::clear(), filestatus::clear(), current_time(), cwd(), configuration_manager::default_file(), 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(), single_job_report::id(), log_manager::init(), table::insert_col(), table::insert_row(), is_timestamp(), timestamp::make_str_(), make_time_string_(), table::mf_add_elt(), timer::mf_make_string(), timer::mf_make_timer_string(), job_archiver::mf_process_rsync_io(), 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_archive_path(), parse_dirname(), job_parser::parse_exclude_from(), job_parser::parse_groupname(), job_parser::parse_include(), global_parser::parse_include(), job_parser::parse_include_from(), global_parser::parse_include_job(), job_parser::parse_jobname(), job_parser::parse_path(), job_parser::parse_rsync_options_context(), job_parser::parse_rsync_remote_module(), job_parser::parse_rsync_remote_path(), job_parser::parse_rsync_remote_user(), 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 configuration_manager::use_default().


Function Documentation

const char* get_error_str const int  a_err  ) 
 

Definition at line 380 of file error.cc.

Referenced by error::push_back().

std::ostream& operator<< std::ostream &  a_out,
const error a_e
 

Definition at line 375 of file error.cc.

References error::write().

Here is the call graph for this function:


Generated on Mon Jul 12 12:03:39 2004 for rvm by doxygen 1.3.6