Problem
lib/core/database/database_error_mapper.dart and the pools:
- Raw
Bad state:. The pools rethrow StateError('... connection pool exhausted: 32 slots in use.') (on StateError { rethrow; }) and it reaches the UI as Bad state: PostgreSQL connection pool exhausted....
- Reset vs refused. Any
SocketException becomes HostUnreachableException (did not accept the connection), including Connection reset by peer and Broken pipe on a session that was working: the server closed it, it did not refuse it.
- TLS.
HandshakeException, CERTIFICATE_VERIFY_FAILED, unknown ca, hostname mismatch are unmapped and show the raw text; the fix (SSL mode, root certificate) is not suggested.
Scope
- Map pool exhaustion to a typed error with a hint (close unused tabs or connections).
- A connection lost error for reset / broken pipe / EOF on an established session, with a reconnect hint.
- A TLS error class with a hint pointing at the SSL mode and root certificate fields.
- Mapper tests for each.
Acceptance
Problem
lib/core/database/database_error_mapper.dartand the pools:Bad state:. The pools rethrowStateError('... connection pool exhausted: 32 slots in use.')(on StateError { rethrow; }) and it reaches the UI asBad state: PostgreSQL connection pool exhausted....SocketExceptionbecomesHostUnreachableException(did not accept the connection), including Connection reset by peer and Broken pipe on a session that was working: the server closed it, it did not refuse it.HandshakeException,CERTIFICATE_VERIFY_FAILED, unknown ca, hostname mismatch are unmapped and show the raw text; the fix (SSL mode, root certificate) is not suggested.Scope
Acceptance
Bad state:for pool exhaustion.