Skip to content

Commit 91983b6

Browse files
committed
REFACTOR: Unified error-return macros via signal dispatch
Replaced per-signal error-return macro families (OTEL_*_ERETURN*) with a centralised token-paste dispatch mechanism. Each signal type now resolves its error-string pointer through OTEL_ERR_<signal> macros, eliminating duplicated do/while bodies in signal headers and ensuring consistent error handling across span, tracer, meter, and logger. Renamed OTEL_ERETURN* to OTEL_SIGNAL_RETURN*, added signal-agnostic OTEL_RETURN* convenience macros, and updated all call sites in headers and source files.
1 parent c377fce commit 91983b6

File tree

18 files changed

+336
-317
lines changed

18 files changed

+336
-317
lines changed

include/define.h

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,32 @@ template <typename T> otel_defer_struct<T>make_defer(T fn) { return { fn }; }
103103

104104
#define OTEL_ERROR_MSG_ENOMEM(s) "Unable to allocate memory for " s
105105

106-
#define OTEL_ERROR(f, ...) do { if (otelc_sprintf(err, f, ##__VA_ARGS__) > 0) OTELC_DBG(OTEL, "%s", *err); } while (0)
107-
#define OTEL_ERETURN(f, ...) do { OTEL_ERROR(f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
108-
#define OTEL_ERETURN_EX(t,r,f, ...) do { OTEL_ERROR(f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
109-
#define OTEL_ERETURN_INT(f, ...) OTEL_ERETURN_EX(_INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
110-
#define OTEL_ERETURN_PTR(f, ...) OTEL_ERETURN_EX(_PTR, nullptr, f, ##__VA_ARGS__)
106+
#define OTEL_SIGNAL_ERROR(e,f, ...) do { if (otelc_sprintf(&(e), f, ##__VA_ARGS__) > 0) OTELC_DBG(OTEL, "%s", (e)); } while (0)
107+
#define OTEL_SIGNAL_RETURN(e,f, ...) do { OTEL_SIGNAL_ERROR((e), f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
108+
#define OTEL_SIGNAL_RETURN_EX(e,t,r,f, ...) do { OTEL_SIGNAL_ERROR((e), f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
109+
#define OTEL_SIGNAL_RETURN_INT(e,f, ...) OTEL_SIGNAL_RETURN_EX((e), _INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
110+
#define OTEL_SIGNAL_RETURN_PTR(e,f, ...) OTEL_SIGNAL_RETURN_EX((e), _PTR, nullptr, f, ##__VA_ARGS__)
111111

112-
#define OTEL_CATCH_ERETURN(arg_func, arg_return, arg_fmt, ...) \
112+
/***
113+
* Token-paste dispatch table for error-string pointers. Each OTEL_ERR_<signal>
114+
* macro resolves to the error-string pointer appropriate for the given context,
115+
* so a single OTEL_RETURN*(signal, ...) call works uniformly across all signal
116+
* types.
117+
*/
118+
#define OTEL_ERR_span span->tracer->err
119+
#define OTEL_ERR_tracer tracer->err
120+
#define OTEL_ERR_meter meter->err
121+
#define OTEL_ERR_logger logger->err
122+
#define OTEL_ERR_err *err
123+
#define OTEL_RETURN(s,f, ...) OTEL_SIGNAL_RETURN(OTEL_ERR_##s, f, ##__VA_ARGS__)
124+
#define OTEL_RETURN_EX(s,t,r,f, ...) OTEL_SIGNAL_RETURN_EX(OTEL_ERR_##s, t, (r), f, ##__VA_ARGS__)
125+
#define OTEL_RETURN_INT(s,f, ...) OTEL_SIGNAL_RETURN_INT(OTEL_ERR_##s, f, ##__VA_ARGS__)
126+
#define OTEL_RETURN_PTR(s,f, ...) OTEL_SIGNAL_RETURN_PTR(OTEL_ERR_##s, f, ##__VA_ARGS__)
127+
128+
#define OTEL_ERR_RETURN_INT(f, ...) OTEL_RETURN_INT(err, f, ##__VA_ARGS__)
129+
#define OTEL_ERR_RETURN_PTR(f, ...) OTEL_RETURN_PTR(err, f, ##__VA_ARGS__)
130+
131+
#define OTEL_CATCH_SIGNAL_RETURN(arg_func, arg_return, arg_fmt, ...) \
113132
catch (const std::exception &e) { \
114133
arg_func; \
115134
arg_return(arg_fmt ": %s", ##__VA_ARGS__, e.what()); \

include/logger.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
#define OTEL_YAML_LOGGER_PREFIX "/signals/logs"
2020

21-
#define OTEL_LOGGER_ERROR(f, ...) do { (void)otelc_sprintf(&(logger->err), f, ##__VA_ARGS__); OTELC_DBG(OTEL, "%s", logger->err); } while (0)
22-
#define OTEL_LOGGER_ERETURN(f, ...) do { OTEL_LOGGER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
23-
#define OTEL_LOGGER_ERETURN_EX(t,r,f, ...) do { OTEL_LOGGER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
24-
#define OTEL_LOGGER_ERETURN_INT(f, ...) OTEL_LOGGER_ERETURN_EX(_INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
25-
#define OTEL_LOGGER_ERETURN_PTR(f, ...) OTEL_LOGGER_ERETURN_EX(_PTR, nullptr, f, ##__VA_ARGS__)
21+
#define OTEL_LOGGER_ERROR(f, ...) OTEL_SIGNAL_ERROR(logger->err, f, ##__VA_ARGS__)
22+
#define OTEL_LOGGER_RETURN(f, ...) OTEL_RETURN(logger, f, ##__VA_ARGS__)
23+
#define OTEL_LOGGER_RETURN_EX(t,r,f, ...) OTEL_RETURN_EX(logger, t, (r), f, ##__VA_ARGS__)
24+
#define OTEL_LOGGER_RETURN_INT(f, ...) OTEL_RETURN_INT(logger, f, ##__VA_ARGS__)
25+
#define OTEL_LOGGER_RETURN_PTR(f, ...) OTEL_RETURN_PTR(logger, f, ##__VA_ARGS__)
2626

2727
#endif /* _OPENTELEMETRY_C_WRAPPER_LOGGER_H_ */
2828

include/meter.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#define OTEL_YAML_METER_PREFIX "/signals/metrics"
2020
#define OTEL_YAML_READERS "/readers"
2121

22-
#define OTEL_METER_ERROR(f, ...) do { (void)otelc_sprintf(&(meter->err), f, ##__VA_ARGS__); OTELC_DBG(OTEL, "%s", meter->err); } while (0)
23-
#define OTEL_METER_ERETURN(f, ...) do { OTEL_METER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
24-
#define OTEL_METER_ERETURN_EX(t,r,f, ...) do { OTEL_METER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
25-
#define OTEL_METER_ERETURN_INT(f, ...) OTEL_METER_ERETURN_EX(_INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
26-
#define OTEL_METER_ERETURN_PTR(f, ...) OTEL_METER_ERETURN_EX(_PTR, nullptr, f, ##__VA_ARGS__)
22+
#define OTEL_METER_ERROR(f, ...) OTEL_SIGNAL_ERROR(meter->err, f, ##__VA_ARGS__)
23+
#define OTEL_METER_RETURN(f, ...) OTEL_RETURN(meter, f, ##__VA_ARGS__)
24+
#define OTEL_METER_RETURN_EX(t,r,f, ...) OTEL_RETURN_EX(meter, t, (r), f, ##__VA_ARGS__)
25+
#define OTEL_METER_RETURN_INT(f, ...) OTEL_RETURN_INT(meter, f, ##__VA_ARGS__)
26+
#define OTEL_METER_RETURN_PTR(f, ...) OTEL_RETURN_PTR(meter, f, ##__VA_ARGS__)
2727

2828
#define OTEL_INSTRUMENT_HANDLE(a) otel_map_find(OTEL_HANDLE(otel_instrument, shards[0].map), (a))
2929
#define OTEL_DBG_INSTRUMENT() OTEL_DBG_HANDLE(OTEL, "otel_instrument", otel_instrument)
@@ -113,7 +113,7 @@ struct T {
113113
\
114114
const auto instrument = OTEL_INSTRUMENT_HANDLE(arg_idx); \
115115
if (OTEL_NULL(instrument)) \
116-
OTEL_METER_ERETURN##arg_type("Invalid OpenTelemetry meter instrument index: %d", (arg_idx));
116+
OTEL_METER_RETURN##arg_type("Invalid OpenTelemetry meter instrument index: %d", (arg_idx));
117117

118118
/***
119119
* Generates an observable callback function that adapts the OpenTelemetry
@@ -156,7 +156,7 @@ struct T {
156156
* is a no-op; for observable types it invokes the appropriate int64 or double
157157
* callback adapter.
158158
*
159-
* Requires 'meter' in scope for OTEL_METER_ERETURN_INT.
159+
* Requires 'meter' in scope for OTEL_METER_RETURN_INT.
160160
*/
161161
#define OTEL_METER_OBSERVABLE_DISPATCH(arg_instr, arg_meth, arg_state) \
162162
if ((arg_instr)->type == OTELC_METRIC_INSTRUMENT_COUNTER_UINT64) \
@@ -185,7 +185,7 @@ struct T {
185185
(arg_instr)->observable->arg_meth(otel_meter_observable_double_cb, OTEL_CAST_REINTERPRET(void *, (arg_state))); \
186186
OTEL_METER_OBSERVABLE_DISPATCH_GAUGE(arg_instr) \
187187
else \
188-
OTEL_METER_ERETURN_INT("Invalid OpenTelemetry meter instrument type: %d", (arg_instr)->type)
188+
OTEL_METER_RETURN_INT("Invalid OpenTelemetry meter instrument type: %d", (arg_instr)->type)
189189

190190

191191
#ifdef OTELC_USE_STATIC_HANDLE

include/span.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#ifndef _OPENTELEMETRY_C_WRAPPER_SPAN_H_
1717
#define _OPENTELEMETRY_C_WRAPPER_SPAN_H_
1818

19-
#define OTEL_SPAN_ERROR(f, ...) do { (void)otelc_sprintf(&(span->tracer->err), f, ##__VA_ARGS__); OTELC_DBG(OTEL, "%s", span->tracer->err); } while (0)
20-
#define OTEL_SPAN_ERETURN(f, ...) do { OTEL_SPAN_ERROR(f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
21-
#define OTEL_SPAN_ERETURN_EX(t,r,f, ...) do { OTEL_SPAN_ERROR(f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
22-
#define OTEL_SPAN_ERETURN_INT(f, ...) OTEL_SPAN_ERETURN_EX(_INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
23-
#define OTEL_SPAN_ERETURN_PTR(f, ...) OTEL_SPAN_ERETURN_EX(_PTR, nullptr, f, ##__VA_ARGS__)
19+
#define OTEL_SPAN_ERROR(f, ...) OTEL_SIGNAL_ERROR(span->tracer->err, f, ##__VA_ARGS__)
20+
#define OTEL_SPAN_RETURN(f, ...) OTEL_RETURN(span, f, ##__VA_ARGS__)
21+
#define OTEL_SPAN_RETURN_EX(t,r,f, ...) OTEL_RETURN_EX(span, t, (r), f, ##__VA_ARGS__)
22+
#define OTEL_SPAN_RETURN_INT(f, ...) OTEL_RETURN_INT(span, f, ##__VA_ARGS__)
23+
#define OTEL_SPAN_RETURN_PTR(f, ...) OTEL_RETURN_PTR(span, f, ##__VA_ARGS__)
2424

2525
#define OTEL_SPAN_HANDLE(a) otel_map_find(OTEL_HANDLE(otel_span, get_shard((a)->idx).map), (a)->idx)
2626
#define OTEL_SPAN_CONTEXT_HANDLE(a) otel_map_find(OTEL_HANDLE(otel_span_context, get_shard((a)->idx).map), (a)->idx)
@@ -103,7 +103,7 @@ struct T {
103103
if (OTEL_NULL(handle)) { \
104104
OTELC_DBG(OTEL, "invalid otel_span[%" PRId64 "]", (arg_handle)->idx); \
105105
\
106-
OTEL_SPAN_ERETURN##arg_type(arg_msg); \
106+
OTEL_SPAN_RETURN##arg_type(arg_msg); \
107107
}
108108

109109
#define OTEL_LOCK_SPAN_CONTEXT_HANDLE(arg_type, arg_handle) \
@@ -119,7 +119,7 @@ struct T {
119119
/***
120120
* Updates the baggage context after modifying baggage entries, then returns
121121
* from the calling function. This is a macro because it must call
122-
* OTEL_SPAN_ERETURN_INT, which returns from the caller on error.
122+
* OTEL_SPAN_RETURN_INT, which returns from the caller on error.
123123
*
124124
* SetBaggage() produces a new Context that does not carry the span token, so
125125
* SetSpan() is called to re-associate the original span with the new Context.
@@ -137,7 +137,7 @@ struct T {
137137
auto c2_ = otel_trace::SetSpan(c1_, otel_trace::GetSpan(*((arg_handle)->context))); \
138138
auto c3_ = otel::make_shared_nothrow<otel_context::Context>(std::move(c2_)); \
139139
if (OTEL_NULL(c3_)) \
140-
OTEL_SPAN_ERETURN_INT(OTEL_ERROR_MSG_ENOMEM("baggage context")); \
140+
OTEL_SPAN_RETURN_INT(OTEL_ERROR_MSG_ENOMEM("baggage context")); \
141141
\
142142
(arg_handle)->context = std::move(c3_); \
143143
\

include/tracer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
#define OTEL_YAML_PROCESSORS "/processors"
2323
#define OTEL_YAML_EXPORTERS "/exporters"
2424

25-
#define OTEL_TRACER_ERROR(f, ...) do { (void)otelc_sprintf(&(tracer->err), f, ##__VA_ARGS__); OTELC_DBG(OTEL, "%s", tracer->err); } while (0)
26-
#define OTEL_TRACER_ERETURN(f, ...) do { OTEL_TRACER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN(); } while (0)
27-
#define OTEL_TRACER_ERETURN_EX(t,r,f, ...) do { OTEL_TRACER_ERROR(f, ##__VA_ARGS__); OTELC_RETURN##t(r); } while (0)
28-
#define OTEL_TRACER_ERETURN_INT(f, ...) OTEL_TRACER_ERETURN_EX(_INT, OTELC_RET_ERROR, f, ##__VA_ARGS__)
29-
#define OTEL_TRACER_ERETURN_PTR(f, ...) OTEL_TRACER_ERETURN_EX(_PTR, nullptr, f, ##__VA_ARGS__)
25+
#define OTEL_TRACER_ERROR(f, ...) OTEL_SIGNAL_ERROR(tracer->err, f, ##__VA_ARGS__)
26+
#define OTEL_TRACER_RETURN(f, ...) OTEL_RETURN(tracer, f, ##__VA_ARGS__)
27+
#define OTEL_TRACER_RETURN_EX(t,r,f, ...) OTEL_RETURN_EX(tracer, t, (r), f, ##__VA_ARGS__)
28+
#define OTEL_TRACER_RETURN_INT(f, ...) OTEL_RETURN_INT(tracer, f, ##__VA_ARGS__)
29+
#define OTEL_TRACER_RETURN_PTR(f, ...) OTEL_RETURN_PTR(tracer, f, ##__VA_ARGS__)
3030

3131
#endif /* _OPENTELEMETRY_C_WRAPPER_TRACER_H_ */
3232

include/util.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ constexpr size_t OTEL_HANDLE_MAP_SHARDS = 64;
5656
err_macro(dup_msg); \
5757
} \
5858
} \
59-
OTEL_CATCH_ERETURN({ \
59+
OTEL_CATCH_SIGNAL_RETURN({ \
6060
if (emplace_ok) \
6161
OTEL_HANDLE(map_name, get_shard(idx).map).erase(idx); \
6262
\
@@ -119,9 +119,9 @@ decltype(auto) otelc_value_visit(const struct otelc_value *v, F &&f)
119119
else if (OTELC_IN_RANGE((arg_value)->u_type, OTELC_VALUE_BOOL, OTELC_VALUE_DATA)) \
120120
otelc_value_visit((arg_value), [&](auto val_) { arg_map.arg_operation((arg_key), val_); }); \
121121
else \
122-
OTEL_ERETURN##arg_type("%s", (arg_fmt)); \
122+
OTEL_ERR_RETURN##arg_type("%s", (arg_fmt)); \
123123
} \
124-
OTEL_CATCH_ERETURN( , OTEL_ERETURN##arg_type, arg_fmt) \
124+
OTEL_CATCH_SIGNAL_RETURN( , OTEL_ERR_RETURN##arg_type, arg_fmt) \
125125
} while (0)
126126

127127
/***
@@ -377,7 +377,7 @@ struct otel_handle {
377377
OTELC_RETURN_INT(OTELC_RET_OK); \
378378
} \
379379
\
380-
OTEL_##arg_signal##_ERETURN_INT(arg_msg);
380+
OTEL_##arg_signal##_RETURN_INT(arg_msg);
381381

382382

383383
extern otelc_ext_malloc_t otelc_ext_malloc;

src/.build-counter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
823
1+
842

src/exporter.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ static int otel_exporter_set_otlp_file_options(const char *desc, const char *pat
9090
OTELC_FUNC("\"%s\", \"%s\", <options>, %p:%p, \"%s\"", OTELC_STR_ARG(desc), OTELC_STR_ARG(path), OTELC_DPTR_ARGS(err), OTELC_STR_ARG(name));
9191

9292
if (OTEL_NULL(desc))
93-
OTEL_ERETURN_INT("Exporter description not specified");
93+
OTEL_ERR_RETURN_INT("Exporter description not specified");
9494
else if (OTEL_NULL(path))
95-
OTEL_ERETURN_INT("Exporter path not specified");
95+
OTEL_ERR_RETURN_INT("Exporter path not specified");
9696

9797
rc = yaml_get_node(otelc_fyd, err, 1, desc, path, name,
9898
OTEL_YAML_ARG_STR(0, EXPORTERS, thread_name),
@@ -107,9 +107,9 @@ static int otel_exporter_set_otlp_file_options(const char *desc, const char *pat
107107
OTELC_RETURN_INT(OTELC_RET_ERROR);
108108
else if (rc == 0) {
109109
if (OTEL_NULL(name))
110-
OTEL_ERETURN_INT("OpenTelemetry exporter type not specified");
110+
OTEL_ERR_RETURN_INT("OpenTelemetry exporter type not specified");
111111
else
112-
OTEL_ERETURN_INT("'%s': OpenTelemetry exporter type not specified", name);
112+
OTEL_ERR_RETURN_INT("'%s': OpenTelemetry exporter type not specified", name);
113113
}
114114

115115
fs_options.file_pattern = file_pattern;
@@ -178,11 +178,11 @@ static int otel_exporter_set_otlp_grpc_options(const char *desc, const char *pat
178178
OTELC_FUNC("\"%s\", \"%s\", \"%s\", <options>, %p:%p, \"%s\"", OTELC_STR_ARG(desc), OTELC_STR_ARG(path), OTELC_STR_ARG(endpoint), OTELC_DPTR_ARGS(err), OTELC_STR_ARG(name));
179179

180180
if (OTEL_NULL(desc))
181-
OTEL_ERETURN_INT("Exporter description not specified");
181+
OTEL_ERR_RETURN_INT("Exporter description not specified");
182182
else if (OTEL_NULL(path))
183-
OTEL_ERETURN_INT("Exporter path not specified");
183+
OTEL_ERR_RETURN_INT("Exporter path not specified");
184184
else if (OTEL_NULL(endpoint))
185-
OTEL_ERETURN_INT("Exporter endpoint not specified");
185+
OTEL_ERR_RETURN_INT("Exporter endpoint not specified");
186186

187187
rc = yaml_get_node(otelc_fyd, err, 1, desc, path, name,
188188
OTEL_YAML_ARG_STR(0, EXPORTERS, thread_name),
@@ -279,11 +279,11 @@ static int otel_exporter_set_otlp_http_options(const char *desc, const char *pat
279279
OTELC_FUNC("\"%s\", \"%s\", \"%s\", <options>, %p:%p, \"%s\"", OTELC_STR_ARG(desc), OTELC_STR_ARG(path), OTELC_STR_ARG(endpoint), OTELC_DPTR_ARGS(err), OTELC_STR_ARG(name));
280280

281281
if (OTEL_NULL(desc))
282-
OTEL_ERETURN_INT("Exporter description not specified");
282+
OTEL_ERR_RETURN_INT("Exporter description not specified");
283283
else if (OTEL_NULL(path))
284-
OTEL_ERETURN_INT("Exporter path not specified");
284+
OTEL_ERR_RETURN_INT("Exporter path not specified");
285285
else if (OTEL_NULL(endpoint))
286-
OTEL_ERETURN_INT("Exporter endpoint not specified");
286+
OTEL_ERR_RETURN_INT("Exporter endpoint not specified");
287287

288288
rc = yaml_get_node(otelc_fyd, err, 1, desc, path, name,
289289
OTEL_YAML_ARG_STR(0, EXPORTERS, thread_name),
@@ -319,7 +319,7 @@ static int otel_exporter_set_otlp_http_options(const char *desc, const char *pat
319319
else if (strcasecmp(content_type, "binary") == 0)
320320
options.content_type = otel_exporter_otlp::HttpRequestContentType::kBinary;
321321
else if (*content_type != '\0')
322-
OTEL_ERETURN_INT("Invalid content_type: '%s'", content_type);
322+
OTEL_ERR_RETURN_INT("Invalid content_type: '%s'", content_type);
323323

324324
/* <opentelemetry/exporters/otlp/otlp_http.h> */
325325
if (strcasecmp(json_bytes_mapping, "hexid") == 0)
@@ -329,15 +329,15 @@ static int otel_exporter_set_otlp_http_options(const char *desc, const char *pat
329329
else if (strcasecmp(json_bytes_mapping, "base64") == 0)
330330
options.json_bytes_mapping = otel_exporter_otlp::JsonBytesMappingKind::kBase64;
331331
else if (*json_bytes_mapping != '\0')
332-
OTEL_ERETURN_INT("Invalid json_bytes_mapping: '%s'", json_bytes_mapping);
332+
OTEL_ERR_RETURN_INT("Invalid json_bytes_mapping: '%s'", json_bytes_mapping);
333333

334334
if (!OTEL_NULL(http_headers))
335335
for (size_t i = 0; i < http_headers->count; i++) {
336336
try {
337337
OTEL_DBG_THROW();
338338
otlp_http_headers.emplace(std::string{http_headers->key[i]}, std::string{http_headers->value[i]});
339339
}
340-
OTEL_CATCH_ERETURN( , OTEL_ERETURN_INT, "Unable to add HTTP header")
340+
OTEL_CATCH_SIGNAL_RETURN( , OTEL_ERR_RETURN_INT, "Unable to add HTTP header")
341341
}
342342

343343
options.url = endpoint;
@@ -409,9 +409,9 @@ static int otel_exporter_set_ostream_options(const char *desc, const char *path,
409409
OTELC_FUNC("\"%s\", \"%s\", <stream>, <exporter>, %p:%p, \"%s\"", OTELC_STR_ARG(desc), OTELC_STR_ARG(path), OTELC_DPTR_ARGS(err), OTELC_STR_ARG(name));
410410

411411
if (OTEL_NULL(desc))
412-
OTEL_ERETURN_INT("Exporter description not specified");
412+
OTEL_ERR_RETURN_INT("Exporter description not specified");
413413
else if (OTEL_NULL(path))
414-
OTEL_ERETURN_INT("Exporter path not specified");
414+
OTEL_ERR_RETURN_INT("Exporter path not specified");
415415

416416
rc = yaml_get_node(otelc_fyd, err, 1, desc, path, name, OTEL_YAML_ARG_STR(0, EXPORTERS, filename), OTEL_YAML_END);
417417
if (rc == OTELC_RET_ERROR)
@@ -426,7 +426,7 @@ static int otel_exporter_set_ostream_options(const char *desc, const char *path,
426426
else {
427427
stream.open(filename, std::ios::out);
428428
if (stream.fail())
429-
OTEL_ERETURN_INT("'%s': %s", filename, otel_strerror(errno));
429+
OTEL_ERR_RETURN_INT("'%s': %s", filename, otel_strerror(errno));
430430
else
431431
exporter = otel::make_unique_nothrow<C>(stream);
432432
}
@@ -435,7 +435,7 @@ static int otel_exporter_set_ostream_options(const char *desc, const char *path,
435435
if (stream.is_open())
436436
stream.close();
437437

438-
OTEL_ERETURN_INT("Unable to create ostream exporter");
438+
OTEL_ERR_RETURN_INT("Unable to create ostream exporter");
439439
}
440440

441441
OTELC_RETURN_INT(OTELC_RET_OK);
@@ -525,7 +525,7 @@ int otel_tracer_exporter_create(struct otelc_tracer *tracer, std::unique_ptr<ote
525525
else if (strcasecmp(format, "protobuf") == 0)
526526
options.format = otel_exporter_zipkin::TransportFormat::kProtobuf;
527527
else if (*format != '\0')
528-
OTEL_TRACER_ERETURN_INT("Invalid Zipkin exporter format: '%s'", format);
528+
OTEL_TRACER_RETURN_INT("Invalid Zipkin exporter format: '%s'", format);
529529

530530
options.endpoint = endpoint;
531531
options.service_name = service_name;
@@ -757,7 +757,7 @@ int otel_logger_exporter_create(struct otelc_logger *logger, std::unique_ptr<ote
757757
OTEL_DBG_THROW();
758758
es_http_headers.emplace(std::string{http_headers->key[i]}, std::string{http_headers->value[i]});
759759
}
760-
OTEL_CATCH_ERETURN( , OTEL_LOGGER_ERETURN_INT, "Unable to add HTTP header")
760+
OTEL_CATCH_SIGNAL_RETURN( , OTEL_LOGGER_RETURN_INT, "Unable to add HTTP header")
761761
}
762762

763763
options.host_ = host;

0 commit comments

Comments
 (0)