taocpp / taopq

C++ client library for PostgreSQL
Boost Software License 1.0
264 stars 40 forks source link

Use a separate network error type when polling fails because of a network error #67

Closed MeanSquaredError closed 1 year ago

MeanSquaredError commented 1 year ago

Currently when connection polling fails in WSAPoll/poll the library throws a generic std::runtime_error. This happen in various cases including

It makes sense to differentiate network errors like the above and internal errors caused by other reasons. For network errors some kind of retry mechanism could be used, while internal errors should probably cause program termination and/or a crash dump.

This pull request adds a separate network error type which is used when polling yields unexpected event flags, thus allowing differentiation between network error and internal errors.

codecov-commenter commented 1 year ago

Codecov Report

Base: 99.65% // Head: 99.65% // No change to project coverage :thumbsup:

Coverage data is based on head (72491b4) compared to base (eba92ef). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #67 +/- ## ======================================= Coverage 99.65% 99.65% ======================================= Files 68 68 Lines 2297 2297 ======================================= Hits 2289 2289 Misses 8 8 ``` | [Impacted Files](https://codecov.io/gh/taocpp/taopq/pull/67?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=taocpp) | Coverage Δ | | |---|---|---| | [src/lib/pq/connection.cpp](https://codecov.io/gh/taocpp/taopq/pull/67/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=taocpp#diff-c3JjL2xpYi9wcS9jb25uZWN0aW9uLmNwcA==) | `98.66% <ø> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=taocpp). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=taocpp)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.