Skip to content

Commit

Permalink
update some
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 13, 2020
1 parent 7f08af4 commit 9046344
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ jobs:

steps:
- uses: actions/checkout@v2
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: mbstring, dom, fileinfo, mysql, openssl, redis #optional, setup extensions
Expand Down
7 changes: 4 additions & 3 deletions src/db/src/Connection/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ protected function runQueryCallback(string $query, array $bindings, Closure $cal
$this->releaseOrRemove();

// Throw exception
throw new DbException($e->getMessage(), $e->getCode());
throw new DbException($e->getMessage(), $e->getCode(), $e);
}

// If an exception occurs when attempting to run a query, we'll format the error
Expand All @@ -695,10 +695,10 @@ protected function runQueryCallback(string $query, array $bindings, Closure $cal

// Print Error Sql
$rawSql = $this->getRawSql($query, $bindings);
CLog::error('Fail sql = <error>%s</error>', $rawSql);
CLog::error('Fail err=<error>%s</error> sql=%s', $e->getMessage(), $rawSql);

// Throw exception
throw new DbException($e->getMessage(), $e->getCode());
throw new DbException($e->getMessage(), $e->getCode(), $e);
}

$this->pdoType = self::TYPE_DEFAULT;
Expand Down Expand Up @@ -1111,6 +1111,7 @@ private function parseDbName(string $dns): void
if (count($explodeParams) !== 2) {
throw new DbException(sprintf('Dsn(%s) format error, please check Dsn', $dns));
}

[$key, $value] = $explodeParams;
$params[$key] = $value;
}
Expand Down
5 changes: 2 additions & 3 deletions src/db/src/Exception/DbException.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?php declare(strict_types=1);


namespace Swoft\Db\Exception;

use Exception;
use RuntimeException;

/**
* Class DbException
*
* @since 2.0
*/
class DbException extends Exception
class DbException extends RuntimeException
{

}
7 changes: 4 additions & 3 deletions src/websocket-server/src/Swoole/HandshakeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ public function onHandshake(Request $request, Response $response): bool
$ctx = WsHandshakeContext::new($psr7Req, $psr7Res);
$conn = Connection::new($wsServer, $psr7Req, $psr7Res);

// Storage connection and bind cid => sid(fd)
// old: Session::set($sid, $conn);
$manager->set($sid, $conn);
// Storage context
Context::set($ctx);

try {
// Storage connection and bind cid => sid(fd)
// old: Session::set($sid, $conn);
$manager->set($sid, $conn);

Swoft::trigger(WsServerEvent::HANDSHAKE_BEFORE, $fd, $request, $response);

/** @var Psr7Response $psr7Res */
Expand Down

0 comments on commit 9046344

Please sign in to comment.