예제 #1
0
void protonError(int err, char *step, pn_messenger_t *messenger)
{
    const char *errMsg = NULL;

    if (0 == err)
    {
        return;
    }
    printf("ERROR: PROTON API: %s Errno: %d (%s)\n", step, err, pn_code(err));
    
#if (PN_VERSION_MINOR == 4)
    /*
    ** Proton-C 0.4 returns an error message directly
    */
    errMsg = pn_messenger_error(messenger);
    if (NULL == errMsg)
    {
        errMsg = "pn_messenger_error() returned NULL";
    }
#else
    /*
    ** Proton-C 0.5 and later returns an error structure which
    ** you retrieve the error message from as a separate step.
    */
    {
        pn_error_t *errInfo = pn_messenger_error(messenger);
        errMsg = pn_error_text(errInfo);
    }
#endif

    printf("ERROR: PROTON Msg: %s\n", (NULL == errMsg) ? "NULL" : errMsg);
}
예제 #2
0
void amqp::Sender::_throwError()
{
	throw std::exception(pn_error_text(pn_messenger_error(m_messenger)));
}