From 8e7d1fb864520425006363fbfdff6b96a5015ed2 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 15 Mar 2018 12:13:04 +0100 Subject: ffi: Improve error reporting when creating contexts. - Usually, we report complex errors by attaching them to the ffi context. However, when we create the contexts, there is no context to attach the error to. Therefore, we add an explicit error argument here. --- ffi/include/sequoia/core.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ffi/include/sequoia/core.h') diff --git a/ffi/include/sequoia/core.h b/ffi/include/sequoia/core.h index da6732aa..d693bb0c 100644 --- a/ffi/include/sequoia/core.h +++ b/ffi/include/sequoia/core.h @@ -134,9 +134,10 @@ typedef enum sq_ipc_policy { /// suggested to use a reversed fully qualified domain name that is /// associated with your application. `domain` must not be `NULL`. /// -/// Returns `NULL` on errors. +/// Returns `NULL` on errors. If `errp` is not `NULL`, the error is +/// stored there. /*/ -sq_context_t sq_context_new(const char *domain); +sq_context_t sq_context_new(const char *domain, sq_error_t *errp); /*/ /// Frees a context. @@ -192,9 +193,10 @@ uint8_t sq_context_ephemeral(const sq_context_t ctx); /*/ /// Finalizes the configuration and return a `Context`. /// -/// Consumes `cfg`. Returns `NULL` on errors. +/// Consumes `cfg`. Returns `NULL` on errors. Returns `NULL` on +/// errors. If `errp` is not `NULL`, the error is stored there. /*/ -sq_context_t sq_config_build(sq_config_t cfg); +sq_context_t sq_config_build(sq_config_t cfg, sq_error_t *errp); /*/ /// Sets the directory containing shared state. -- cgit v1.2.3