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

Set std::optional to std::nullopt instead of throwing sqlite::errors::no_rows #226

Open
blackpill0w opened this issue May 6, 2023 · 0 comments

Comments

@blackpill0w
Copy link

I think this would be better since that is the entire point of std::optional.
I don't see the point of throwing an exception with std::optional.
It makes sense to throw an exception if , say, we have:

int i;
try {
   db << "SELECT..." >> i{};
}
catch (errors::no_rows& e) {...}

but with std::optional it'd be better to do this:

std::optional<int> i{};
db << "SELECT..." >> i;
if (not i) {...}
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

No branches or pull requests

1 participant