Boost logo

Boost :

From: Oliver.Kowalke_at_[hidden]
Date: 2006-12-20 07:19:41


Hello,
It is not so clear for me how to use error_code::new_category.
I've a library which uses two legacy libraries which have error codes
(int) with the same value. How can I incorporate the error codes both
libraries into boost::system?

void f_calls_api_A()
{
   int result( 0);
   if ( ( result = api_A_x() ) == -1)
     throw system_error(
        error_code(
                result,
                       ...) ); // ?
}

void g_calls_api_B()
{
   int result( 0);
   if ( ( result = api_B_y() ) == -1)
     throw system_error(
        error_code(
                result,
                       ...) ); // ?
}

Void main()
{
   try
   {
       f_calls_api_A();
       g_calls_api_B();
   }
   catch ( system_error const& e)
   {
       // how to know if it comes from A or B?
   }
}

Regards,
Oliver


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk