HPX - High Performance ParalleX

PrevUpHomeNext

Class error_code

hpx::error_code — A hpx::error_code represents an arbitrary error condition.

Synopsis

// In header: <hpx/exception.hpp>


class error_code {
public:
  // construct/copy/destruct
  explicit error_code(throwmode = plain);
  explicit error_code(error, throwmode = plain);
  error_code(error, char const *, char const *, long, throwmode = plain);
  error_code(error, char const *, throwmode = plain);
  error_code(error, char const *, char const *, char const *, long, 
             throwmode = plain);
  error_code(error, std::string const &, throwmode = plain);
  error_code(error, std::string const &, char const *, char const *, long, 
             throwmode = plain);
  error_code(int, hpx::exception const &);
  explicit error_code(boost::exception_ptr const &);
  error_code & operator=(error_code const &);

  // public member functions
  std::string get_message() const;
  void clear();
};

Description

The class hpx::error_code describes an object used to hold error code values, such as those originating from the operating system or other low-level application program interfaces.

[Note] Note

Class hpx::error_code is an adjunct to error reporting by exception

error_code public construct/copy/destruct

  1. explicit error_code(throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    Throws:

    nothing
  2. explicit error_code(error e, throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    Throws:

    nothing
  3. error_code(error e, char const * func, char const * file, long line, 
               throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    file

    The file name of the code where the error was raised.

    func

    The name of the function where the error was raised.

    line

    The line number of the code line where the error was raised.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    Throws:

    nothing
  4. error_code(error e, char const * msg, throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    msg

    The parameter msg holds the error message the new exception should encapsulate.

    Throws:

    std::bad_alloc (if allocation of a copy of the passed string fails).
  5. error_code(error e, char const * msg, char const * func, char const * file, 
               long line, throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    file

    The file name of the code where the error was raised.

    func

    The name of the function where the error was raised.

    line

    The line number of the code line where the error was raised.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    msg

    The parameter msg holds the error message the new exception should encapsulate.

    Throws:

    std::bad_alloc (if allocation of a copy of the passed string fails).
  6. error_code(error e, std::string const & msg, throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    msg

    The parameter msg holds the error message the new exception should encapsulate.

    Throws:

    std::bad_alloc (if allocation of a copy of the passed string fails).
  7. error_code(error e, std::string const & msg, char const * func, 
               char const * file, long line, throwmode mode = plain);

    Construct an object of type error_code.

    Parameters:

    e

    The parameter e holds the hpx::error code the new exception should encapsulate.

    file

    The file name of the code where the error was raised.

    func

    The name of the function where the error was raised.

    line

    The line number of the code line where the error was raised.

    mode

    The parameter mode specifies whether the constructed hpx::error_code belongs to the error category hpx_category (if mode is plain, this is the default) or to the category hpx_category_rethrow (if mode is rethrow).

    msg

    The parameter msg holds the error message the new exception should encapsulate.

    Throws:

    std::bad_alloc (if allocation of a copy of the passed string fails).
  8. error_code(int err, hpx::exception const & e);
  9. explicit error_code(boost::exception_ptr const & e);
  10. error_code & operator=(error_code const & rhs);

    Assignment operator for error_code

    [Note] Note

    This function maintains the error category of the left hand side if the right hand side is a success code.

error_code public member functions

  1. std::string get_message() const;

    Return a reference to the error message stored in the hpx::error_code.

    Throws:

    nothing
  2. void clear();
    Clear this error_code object. The postconditions of invoking this method are.
    • value() == hpx::success and category() == hpx::get_hpx_category()


PrevUpHomeNext