mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 20:54:02 +00:00
If harden throws an exception, revert connection back to central
This commit is contained in:
parent
f5f5f1d4aa
commit
52f6857302
2 changed files with 17 additions and 1 deletions
|
|
@ -51,7 +51,16 @@ class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
|||
|
||||
$this->database->connectToTenant($tenant);
|
||||
|
||||
if (static::$harden) $this->harden($tenant);
|
||||
try {
|
||||
if (static::$harden) {
|
||||
$this->harden($tenant);
|
||||
}
|
||||
} catch (RuntimeException $e) {
|
||||
// Revert connection back to central
|
||||
$this->revert();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function revert(): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue