1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-30 04:29:12 +01:00

Remove PendingOperationError / update docs

This commit is contained in:
Aaron Piotrowski 2017-11-05 15:43:40 -06:00
parent 88808aa654
commit eb965b30dd
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
7 changed files with 15 additions and 22 deletions

View File

@ -51,7 +51,6 @@ abstract class AbstractConnection implements Connection {
* @return \Amp\Promise
*
* @throws \Amp\Postgres\FailureException
* @throws \Amp\Postgres\PendingOperationError
*/
private function send(string $methodName, ...$args): \Generator {
while ($this->busy) {

View File

@ -12,7 +12,9 @@ interface Executor {
*
* @return \Amp\Promise<\Amp\Postgres\CommandResult|\Amp\Postgres\TupleResult>
*
* @throws \Amp\Postgres\FailureException
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
* @throws \Amp\Postgres\QueryError If the operation fails due to an error in the query (such as a syntax error).
*/
public function query(string $sql): Promise;
@ -23,8 +25,8 @@ interface Executor {
* @return \Amp\Promise<\Amp\Postgres\CommandResult|\Amp\Postgres\TupleResult>
*
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
* @throws \Amp\Postgres\QueryError If the operation fails due to an error in the query (such as a syntax error).
* @throws \Amp\Postgres\PendingOperationError If another operation is currently pending on the connection.
*/
public function execute(string $sql, ...$params): Promise;
@ -34,8 +36,8 @@ interface Executor {
* @return \Amp\Promise<\Amp\Postgres\Statement>
*
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
* @throws \Amp\Postgres\QueryError If the operation fails due to an error in the query (such as a syntax error).
* @throws \Amp\Postgres\PendingOperationError If another operation is currently pending on the connection.
*/
public function prepare(string $sql): Promise;
@ -46,7 +48,7 @@ interface Executor {
* @return \Amp\Promise<\Amp\Postgres\CommandResult>
*
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\PendingOperationError If another operation is currently pending on the connection.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
*/
public function notify(string $channel, string $payload = ""): Promise;
}

View File

@ -10,7 +10,9 @@ interface Link extends Executor {
*
* @return \Amp\Promise<\Amp\Postgres\Transaction>
*
* @throws \Amp\Postgres\FailureException
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
* @throws \Amp\Postgres\QueryError If the operation fails due to an error in the query (such as a syntax error).
*/
public function transaction(int $isolation = Transaction::COMMITTED): Promise;
@ -19,7 +21,9 @@ interface Link extends Executor {
*
* @return \Amp\Promise<\Amp\Postgres\Listener>
*
* @throws \Amp\Postgres\FailureException
* @throws \Amp\Postgres\FailureException If the operation fails due to unexpected condition.
* @throws \Amp\Postgres\ConnectionException If the connection to the database is lost.
* @throws \Amp\Postgres\QueryError If the operation fails due to an error in the query (such as a syntax error).
*/
public function listen(string $channel): Promise;
}

View File

@ -1,13 +0,0 @@
<?php
namespace Amp\Postgres;
class PendingOperationError extends \Error {
public function __construct(
string $message = "The previous operation must complete before starting another",
int $code = 0,
\Throwable $previous = null
) {
parent::__construct($message, $code, $previous);
}
}

View File

@ -149,7 +149,6 @@ class PgSqlHandle implements Handle {
* @resolve resource
*
* @throws \Amp\Postgres\FailureException
* @throws \Amp\Postgres\PendingOperationError
*/
private function send(callable $function, ...$args): \Generator {
while ($this->deferred) {

View File

@ -136,7 +136,7 @@ class PqHandle implements Handle {
*
* @return \Generator
*
* @resolve resource
* @resolve \Amp\Postgres\CommandResult|\Amp\Postgres\TupleResult|\pq\Statement
*
* @throws \Amp\Postgres\FailureException
*/

View File

@ -13,6 +13,8 @@ use Amp\Promise;
*
* @throws \Amp\Postgres\FailureException If connecting fails.
* @throws \Error If neither ext-pgsql or pecl-pq is loaded.
*
* @codeCoverageIgnore
*/
function connect(string $connectionString, CancellationToken $token = null): Promise {
if (\extension_loaded("pq")) {