Skip to content

Commit

Permalink
Merge pull request #33 from gosuperscript/reconnect-exception
Browse files Browse the repository at this point in the history
Introduce `ConnectionLostException`
  • Loading branch information
ekvedaras authored Feb 18, 2022
2 parents 24c8cd0 + f56ce26 commit ef92f4a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vendor
composer.lock
.idea
.phpunit.result.cache
build
.env
3 changes: 2 additions & 1 deletion src/Console/Commands/EventStoreWorkerThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace DigitalRisks\LaravelEventStore\Console\Commands;

use DigitalRisks\LaravelEventStore\EventStore as LaravelEventStore;
use DigitalRisks\LaravelEventStore\Exceptions\ConnectionLostException;
use DigitalRisks\LaravelEventStore\Services\EventStoreEventService;
use EventLoop\EventLoop;
use Illuminate\Console\Command;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function handle(): void
report($e);
}

report(new \Exception('Lost connection with EventStore - reconnecting'));
report(new ConnectionLostException());
sleep(1);

$this->handle();
Expand Down
13 changes: 13 additions & 0 deletions src/Exceptions/ConnectionLostException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace DigitalRisks\LaravelEventStore\Exceptions;

use Exception;

class ConnectionLostException extends Exception
{
public function __construct($message = 'Lost connection with EventStore - reconnecting', $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

0 comments on commit ef92f4a

Please sign in to comment.