diff --git a/examples/01-example.php b/examples/01-example.php index 0c03279..3926c5e 100644 --- a/examples/01-example.php +++ b/examples/01-example.php @@ -3,7 +3,6 @@ require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/common-part.php'; -use Reindexer\Client\Api; use Reindexer\Entities\Index as IndexEntity; use Reindexer\Services\Database; use Reindexer\Services\Namespaces; @@ -42,7 +41,7 @@ $response = $namespaceService->create($namespaceName, [$indexId]); echo sprintf('Response data: %s', $response->getResponseBody()) . PHP_EOL; } -} catch (Exception $e) { +} catch (\Throwable $e) { echo sprintf( 'Error %s in file %s on line %s', $e->getMessage(), diff --git a/examples/02-example.php b/examples/02-example.php index 8563c0c..1718abe 100644 --- a/examples/02-example.php +++ b/examples/02-example.php @@ -3,7 +3,6 @@ require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/common-part.php'; -use Reindexer\Client\Api; use Reindexer\Services\Namespaces; try { @@ -22,7 +21,7 @@ } else { echo sprintf('Error delete namespace: %s', $response->getResponseBody()); } -} catch (Exception $e) { +} catch (\Throwable $e) { echo sprintf( 'Error %s in file %s on line %s', $e->getMessage(), diff --git a/examples/03-example.php b/examples/03-example.php index 1151e3e..08f19b3 100644 --- a/examples/03-example.php +++ b/examples/03-example.php @@ -3,9 +3,7 @@ require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/common-part.php'; -use Reindexer\Services\Database; use Reindexer\Services\Item; -use Reindexer\Services\Namespaces; use Reindexer\Services\Query; try { @@ -41,5 +39,11 @@ $response = $sqlService->createByHttpGet("SELECT * from $namespaceName"); $response = $sqlService->createSqlQueryByHttpPost("UPDATE $namespaceName SET name = 'John Doe changed 2' WHERE id = 1"); var_dump($response->getResponseBody()); -} catch (Exception $e) { +} catch (\Throwable $e) { + echo sprintf( + 'Error %s in file %s on line %s', + $e->getMessage(), + $e->getFile(), + $e->getLine() + ); }