Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden message_callback against runtime error #884

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

Matthias-NIDEC
Copy link
Contributor

Describe your changes

In terms runtime errors during message handling avoid undefined behavior.

Issue ticket number and link

Checklist before requesting a review

} catch (const json::exception& e) {
EVLOG_error << "JSON exception during reception of message: " << e.what();
this->message_dispatcher->dispatch_call_error(CallError(MessageId("-1"), "GenericError", e.what(), json({})));
return;
} catch (const std::runtime_error& e) {
EVLOG_error << "runtime_error during reception of message: " << e.what();
this->send(CallError(MessageId("-1"), "GenericError", e.what(), json({})));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This send method has been removed, you should probably do something along the lines of:

auto call_error = CallError(MessageId("-1"), "GenericError", e.what(), json({}));
this->message_dispatcher->dispatch_call_error(call_error);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, updated ...

Signed-off-by: Matthias Suess <[email protected]>
@hikinggrass hikinggrass merged commit 254dfbb into EVerest:main Dec 4, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants