PROTON-708: changed pn_driver_error to return the pn_error_t git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/trunk@1632098 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/eb45c9d7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/eb45c9d7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/eb45c9d7 Branch: refs/heads/examples Commit: eb45c9d742ad4961579d8c724fe2947d5cc9f901 Parents: 0329abf Author: Rafael H. Schloming <r...@apache.org> Authored: Wed Oct 15 15:47:26 2014 +0000 Committer: Rafael H. Schloming <r...@apache.org> Committed: Wed Oct 15 15:47:26 2014 +0000 ---------------------------------------------------------------------- proton-c/include/proton/driver.h | 13 ++++++++++--- proton-c/src/posix/driver.c | 8 +++++--- proton-c/src/windows/driver.c | 8 +++++--- 3 files changed, 20 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/eb45c9d7/proton-c/include/proton/driver.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/driver.h b/proton-c/include/proton/driver.h index 6ba2863..ccf80a0 100644 --- a/proton-c/include/proton/driver.h +++ b/proton-c/include/proton/driver.h @@ -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. * http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/eb45c9d7/proton-c/src/posix/driver.c ---------------------------------------------------------------------- diff --git a/proton-c/src/posix/driver.c b/proton-c/src/posix/driver.c index d71ca7d..4bc71bb 100644 --- a/proton-c/src/posix/driver.c +++ b/proton-c/src/posix/driver.c @@ -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) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/eb45c9d7/proton-c/src/windows/driver.c ---------------------------------------------------------------------- diff --git a/proton-c/src/windows/driver.c b/proton-c/src/windows/driver.c index ddccd82..43662f9 100644 --- a/proton-c/src/windows/driver.c +++ b/proton-c/src/windows/driver.c @@ -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: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org