Author: rhs
Date: Wed Oct 15 15:47:26 2014
New Revision: 1632098
URL: http://svn.apache.org/r1632098
Log:
PROTON-708: changed pn_driver_error to return the pn_error_t
Modified:
qpid/proton/trunk/proton-c/include/proton/driver.h
qpid/proton/trunk/proton-c/src/posix/driver.c
qpid/proton/trunk/proton-c/src/windows/driver.c
Modified: qpid/proton/trunk/proton-c/include/proton/driver.h
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/driver.h?rev=1632098&r1=1632097&r2=1632098&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/driver.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/driver.h Wed Oct 15 15:47:26 2014
@@ -73,13 +73,20 @@ PN_EXTERN pn_driver_t *pn_driver(void);
*/
PN_EXTERN int pn_driver_errno(pn_driver_t *d);
-/** Return the most recent error text for d.
+/** Get additional error information associated with the driver.
+ *
+ * Whenever a driver operation fails, additional error information can
+ * be obtained using this function. The error object that is returned
+ * may also be used to clear the error condition.
+ *
+ * The pointer returned by this operation is valid until the
+ * driver object is freed.
*
* @param[in] d the driver
*
- * @return the most recent error text for d
+ * @return the driver's error object
*/
-PN_EXTERN const char *pn_driver_error(pn_driver_t *d);
+PN_EXTERN pn_error_t *pn_driver_error(pn_driver_t *d);
/** Set the tracing level for the given driver.
*
Modified: qpid/proton/trunk/proton-c/src/posix/driver.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/posix/driver.c?rev=1632098&r1=1632097&r2=1632098&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/posix/driver.c (original)
+++ qpid/proton/trunk/proton-c/src/posix/driver.c Wed Oct 15 15:47:26 2014
@@ -576,12 +576,14 @@ pn_driver_t *pn_driver()
int pn_driver_errno(pn_driver_t *d)
{
- return d ? pn_error_code(d->error) : PN_ARG_ERR;
+ assert(d);
+ return pn_error_code(d->error);
}
-const char *pn_driver_error(pn_driver_t *d)
+pn_error_t *pn_driver_error(pn_driver_t *d)
{
- return d ? pn_error_text(d->error) : NULL;
+ assert(d);
+ return d->error;
}
void pn_driver_trace(pn_driver_t *d, pn_trace_t trace)
Modified: qpid/proton/trunk/proton-c/src/windows/driver.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/windows/driver.c?rev=1632098&r1=1632097&r2=1632098&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/windows/driver.c (original)
+++ qpid/proton/trunk/proton-c/src/windows/driver.c Wed Oct 15 15:47:26 2014
@@ -712,12 +712,14 @@ pn_driver_t *pn_driver()
int pn_driver_errno(pn_driver_t *d)
{
- return d ? pn_error_code(d->error) : PN_ARG_ERR;
+ assert(d);
+ return pn_error_code(d->error);
}
-const char *pn_driver_error(pn_driver_t *d)
+pn_error_t *pn_driver_error(pn_driver_t *d)
{
- return d ? pn_error_text(d->error) : NULL;
+ assert(d);
+ return d->error;
}
void pn_driver_trace(pn_driver_t *d, pn_trace_t trace)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]