Skip to content

Commit dcbd551

Browse files
committed
Make error handling a tiny bit better
1 parent 0a66e7f commit dcbd551

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/src/connection.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,14 @@ class _Connection {
212212
}
213213
_completer.complete(response.result);
214214
}
215-
} catch (e) {
215+
} catch (e, st) {
216216
autoRelease = true;
217217
_finishAndReuse();
218218
log.fine("completing with exception: $e");
219-
_completer.completeError(e);
219+
if (_completer.isCompleted) {
220+
throw e;
221+
}
222+
_completer.completeError(e, st);
220223
}
221224
}
222225

lib/src/connection_pool.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ class ConnectionPool extends Object with _ConnectionHelpers implements Queriable
100100
cnx.autoRelease = true;
101101
_log.finest("Logged in on cnx#${cnx.number}");
102102
c.complete(cnx);
103-
} catch (e) {
103+
} catch (e, st) {
104104
if (!(e is MySqlException)) {
105105
_removeConnection(cnx);
106106
}
107-
c.completeError(e);
107+
c.completeError(e, st);
108108
}
109109
}
110110

0 commit comments

Comments
 (0)