mirror of
https://github.com/danog/postgres.git
synced 2024-11-29 20:19:10 +01:00
Improve error message
This commit is contained in:
parent
31b739bc77
commit
b056da210d
@ -21,7 +21,7 @@ final class ConnectionConfig extends SqlConnectionConfig
|
||||
|
||||
return new self(
|
||||
$parts["host"],
|
||||
$parts["port"] ?? self::DEFAULT_PORT,
|
||||
(int) ($parts["port"] ?? self::DEFAULT_PORT),
|
||||
$parts["user"] ?? null,
|
||||
$parts["password"] ?? null,
|
||||
$parts["db"] ?? null
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace Amp\Postgres;
|
||||
|
||||
use Amp\Promise;
|
||||
use Amp\Sql\ConnectionConfig;
|
||||
use Amp\Sql\ConnectionConfig as SqlConnectionConfig;
|
||||
use Amp\Sql\Connector;
|
||||
use Amp\Sql\FailureException;
|
||||
use Amp\TimeoutCancellationToken;
|
||||
@ -30,8 +30,12 @@ final class TimeoutConnector implements Connector
|
||||
*
|
||||
* @throws \Error If neither ext-pgsql or pecl-pq is loaded.
|
||||
*/
|
||||
public function connect(ConnectionConfig $connectionConfig): Promise
|
||||
public function connect(SqlConnectionConfig $connectionConfig): Promise
|
||||
{
|
||||
if (!$connectionConfig instanceof ConnectionConfig) {
|
||||
throw new \TypeError(\sprintf("Must provide an instance of %s to Postgres connectors", ConnectionConfig::class));
|
||||
}
|
||||
|
||||
$token = new TimeoutCancellationToken($this->timeout);
|
||||
|
||||
if (\extension_loaded("pq")) {
|
||||
|
Loading…
Reference in New Issue
Block a user