nats-io / nats.c

A C client for NATS
Apache License 2.0
382 stars 132 forks source link

microEndpoint in microErrorHandler doesn't seem useful #737

Open geiseri opened 5 months ago

geiseri commented 5 months ago

Observed behavior

This is not necessarily a defect, but is more of a suggestion. Feel free to close if it's not something that makes sense.

During compile I see the warning:

[build]  main.cpp:27:59: warning: unused parameter ‘ep’ [-Wunused-parameter]
[build]    27 | static void error_handler(microService *m, microEndpoint *ep, natsStatus s)

Since there is no obvious use for it I need to put in the annoying (void)ep; line to silence warnings. One suggested use would be to provide something like microRequest_GetEndpointState so the endpoint's context can be used for recovery from within the error handler.

Expected behavior

No warning presented, or provide utility to the value passed in.

Server and client version

Server: v2.10.7 Code: 3.7.0

Host environment

No response

Steps to reproduce

Set the callback function to microServiceConfig::ErrHandler and do not add the line (void)ep;