Skip to content

Commit d55b955

Browse files
committed
refactor: Throw Sprout exceptions
1 parent 6648b56 commit d55b955

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Bud.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
namespace Sprout\Bud;
55

66
use Illuminate\Contracts\Foundation\Application;
7-
use RuntimeException;
87
use Sprout\Bud\Contracts\ConfigStore;
98
use Sprout\Bud\Managers\ConfigStoreManager;
109
use Sprout\Concerns\AwareOfTenant;
1110
use Sprout\Contracts\TenantAware;
11+
use Sprout\Exceptions\TenancyMissingException;
12+
use Sprout\Exceptions\TenantMissingException;
1213

1314
final class Bud implements TenantAware
1415
{
@@ -69,15 +70,17 @@ public function store(?string $name = null): ConfigStore
6970
* @return array<string, mixed>|null
7071
*
7172
* @throws \Sprout\Exceptions\MisconfigurationException
73+
* @throws \Sprout\Exceptions\TenancyMissingException
74+
* @throws \Sprout\Exceptions\TenantMissingException
7275
*/
7376
public function config(string $service, string $name, ?array $default = null, ?string $store = null): ?array
7477
{
7578
if (! $this->hasTenancy()) {
76-
throw new RuntimeException('There is no tenancy set');
79+
throw TenancyMissingException::make();
7780
}
7881

7982
if (! $this->hasTenant()) {
80-
throw new RuntimeException('There is no tenant set');
83+
throw TenantMissingException::make($this->getTenancy()->getName());
8184
}
8285

8386
return $this->store($store)

0 commit comments

Comments
 (0)