Repository navigation
fix(connections): Test Connection says why it failed (#1308) - #1323
Merged
Merged
Conversation
- Redis, MySQL and MongoDB testConnection return the reason, in the same mapped words as PostgreSQL (Authentication failed..., Cannot reach...), not a bare bool. - Every form showed 'Connection failed' for any result that did not start with 'error:', so the reason PostgreSQL and SQLite returned was dropped too. connectionTestMessage shows it, and a reason stays on screen for 20 s instead of 5. - The SQLite form's 'error:' text lost its first letter (substring(7)).
Closed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1308
Problem
RedisConnection,MysqlConnectionandMongoConnection.testConnection()returnedbool; the forms showedfailedand the mapped reason (Authentication failed, Cannot reach the database server, ...) was at most adebugPrint.'Connection failed'for any result that did not start witherror:, so even the reason PostgreSQL returned was never shown.error:results were cut withsubstring(7)after a 6-character prefix: the first letter of the message was lost.Fix
({bool ok, String? error}), withdescribeDatabaseError(as the PostgreSQL / SQLite ones do).connection_test_result.dart:connectionTestMessageshows the reason (success/failed/error: .../ a reason),connectionTestResultLifetimekeeps a reason on screen for 20 s (5 s for success). The five forms use them.Tests: the message helper (incl. the SQLite prefix);
RedisConnection.testConnectionreports Authentication failed for a wrong password (tiny RESP server) and Cannot reach for a closed port;MysqlConnection.testConnectionCannot reach for a closed port. MongoDB is not driven in a unit test: the driver retries against a closed port for a long time.