Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass
std::source_location
into libpqxx functions. (#947)
I'm trying to ensure that every libpqxx function that may throw an exception has a `source_location` parameter, and that it passes this to any functions it calls that may throw. The end result would ideally be that any exception thrown by libpqxx would include the location of the original call into libpqxx. (Unless you pass your own choice of source location, of course). In practice, this ideal is not quite attainable... * Parameter packs make it hard — you can't just make a function accept any number of arguments of any type, and then add a `source_location` parameter _after_ that. * With overloaded operators it's completely impossible — there's no way of adding parameters to a function with a fixed, language-dictated signature. * Destructors take no arguments at all, so they're out as well. * Callbacks and string conversions are a problem as well, because their existing definitions don't include `source_location`. I do have a plan for that last item though. I can probably update the signatures and use compile-time introspection (probably using function concepts) to detect whether the given user-defined function supports the old API or the new API. That's a separate job though. Oh, and because I don't want to grow all my function signatures with an additional tedious `std::source_location location = std::source_location::current()` etc, I created a type alias `sl`. Hate how cryptic this makes the functions, but I really need these to be brief.
- Loading branch information