Skip to content

Adding exception type for empty callback functions#301

Closed
gregmedd wants to merge 4 commits intoeclipse-uprotocol:v1.0_up-v1.6.0from
gregmedd:bugfix/1.0.2/194-std-function-checks
Closed

Adding exception type for empty callback functions#301
gregmedd wants to merge 4 commits intoeclipse-uprotocol:v1.0_up-v1.6.0from
gregmedd:bugfix/1.0.2/194-std-function-checks

Conversation

@gregmedd
Copy link
Contributor

This exception will be thrown when an empty std::function is passed to the callback connection module. Adding the type first so that tests can be written.

closes #194

This exception will be thrown when an empty std::function is passed to
the callback connection module. Adding the type first so that tests can
be written.
@gregmedd gregmedd self-assigned this Aug 17, 2024
@github-actions
Copy link

Code coverage report is ready! 📈

@github-actions
Copy link

Code coverage report is ready! 📈

Some L2 tests were asserting that the std::bad_function_call exception
should be thrown when a bad callback is called. We will be changing that
behavior so that the exception is thrown when the callback connection is
established, requiring updated test cases.
The CalleeHandle class is the "owner" of the callback function objects
associated with a callback connection. As such, it will check the
validity of those function objects and throw the EmptyFunctionObject
exception if either the callback or cleanup function is empty / invalid.
@github-actions
Copy link

Code coverage report is ready! 📈

@github-actions
Copy link

Code coverage report is ready! 📈

@gregmedd gregmedd marked this pull request as ready for review August 17, 2024 03:17
Copy link
Member

@agosh01 agosh01 left a comment

Choose a reason for hiding this comment

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

LGTM

PLeVasseur added a commit that referenced this pull request Mar 7, 2025
) (#304)

* Adding exception type for empty callback functions

This exception will be thrown when an empty std::function is passed to
the callback connection module. Adding the type first so that tests can
be written.

* Add callback tests for empty function objects

* Fix null callback assertions in L2 tests

Some L2 tests were asserting that the std::bad_function_call exception
should be thrown when a bad callback is called. We will be changing that
behavior so that the exception is thrown when the callback connection is
established, requiring updated test cases.

* Add empty function checks in CalleeHandle

The CalleeHandle class is the "owner" of the callback function objects
associated with a callback connection. As such, it will check the
validity of those function objects and throw the EmptyFunctionObject
exception if either the callback or cleanup function is empty / invalid.

* Update include/up-cpp/utils/CallbackConnection.h

Co-authored-by: Pete LeVasseur <[email protected]>

* specify Clang version 17 in CI

---------

Co-authored-by: Greg Medding <[email protected]>
Co-authored-by: Pete LeVasseur <[email protected]>
@PLeVasseur
Copy link
Contributor

Closing as duplicate of the now-merged #304

@PLeVasseur PLeVasseur closed this Mar 7, 2025
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.

The callback connection module should check std::function parameters from outside for validity

3 participants