Skip to content
Snippets Groups Projects
Commit 153d18e2 authored by bigbes's avatar bigbes
Browse files

Fix compatibility (again) for box_error_raise

parent 433acaba
No related branches found
No related tags found
No related merge requests found
......@@ -115,8 +115,8 @@ box_error_set(const char *file, unsigned line, uint32_t code,
/**
* A backward-compatible API define.
*/
#define box_error_raise(code, format) \
box_error_set(__FILE__, __LINE__, code, format)
#define box_error_raise(code, format, ...) \
box_error_set(__FILE__, __LINE__, code, format, ##__VA_ARGS__)
/** \endcond public */
......
......@@ -124,6 +124,20 @@ errors(box_function_ctx_t *ctx, const char *args, const char *args_end)
assert(strcmp(box_error_message(error), "Proc error") == 0);
(void) error;
/* Backwards compatibility */
box_error_raise(ER_PROC_C, "hello %s", "world");
assert(box_error_last() != NULL);
error = box_error_last();
assert(box_error_code(error) == ER_PROC_C);
assert(strcmp(box_error_message(error), "hello world") == 0);
/* Backwards compatibility */
box_error_raise(ER_PROC_C, "hello, lalala");
assert(box_error_last() != NULL);
error = box_error_last();
assert(box_error_code(error) == ER_PROC_C);
assert(strcmp(box_error_message(error), "hello, lalala") == 0);
box_error_clear();
assert(box_error_last() == NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment