1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 17:44:04 +00:00

Custom exceptions, fix #91

This commit is contained in:
Samuel Štancl 2019-08-20 12:14:56 +02:00
parent a8936a4c73
commit 4c676b41e9
6 changed files with 32 additions and 6 deletions

View file

@ -6,6 +6,7 @@ use Stancl\Tenancy\Interfaces\StorageDriver;
use Stancl\Tenancy\Traits\BootstrapsTenancy;
use Illuminate\Contracts\Foundation\Application;
use Stancl\Tenancy\Exceptions\CannotChangeUuidOrDomainException;
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
final class TenantManager
{
@ -65,7 +66,7 @@ final class TenantManager
$tenant = $this->storage->identifyTenant($domain);
if (! $tenant || ! \array_key_exists('uuid', $tenant) || ! $tenant['uuid']) {
throw new \Exception("Tenant could not be identified on domain {$domain}.");
throw new TenantCouldNotBeIdentifiedException($domain);
}
return $tenant;
@ -176,7 +177,7 @@ final class TenantManager
$uuid = $this->getIdByDomain($domain);
if (\is_null($uuid)) {
throw new \Exception("Tenant with domain $domain could not be identified.");
throw new TenantCouldNotBeIdentifiedException($domain);
}
return $this->find($uuid, $fields);