I am writing a function for an API which I want to only be called from within a try statement so that developers can handle its custom exceptions.
Instead of just exaggerating the use of error handling in our documentation or using a #warning preprocessor directive, I was wondering if I could raise an error at compile time if the function is being called from outside a try statement?
Is is possible to do this?
All help is appreciated. Thanks in advance!