Skip to content

Commit

Permalink
fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Sep 24, 2024
1 parent a44c501 commit 8cf1423
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions app/Services/EntityService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Models\Entity;
use App\Models\Federation;
use Exception;
use http\Exception\InvalidArgumentException;
use Illuminate\Support\Facades\Storage;

class EntityService
Expand All @@ -20,7 +19,7 @@ public function saveMetadataToFederationFolder($entity_id, $federation_id): void
$federation = Federation::find($federation_id);

if (! $federation) {
throw new Exception("Federation $federation_id not found");
throw new \Exception("Federation $federation_id not found");
}
$this->saveEntityMetadataToFolder($entity_id, $federation->xml_id);
}
Expand All @@ -36,7 +35,7 @@ public function saveEntityMetadataToFolder($entity_id, $folderName): void

$entity = Entity::find($entity_id);
if (! $entity) {
throw new Exception("Entity not found with id $entity_id");
throw new \Exception("Entity not found with id $entity_id");
}
$fileName = $entity->file;
if (! Storage::disk($diskName)->exists($folderName)) {
Expand All @@ -56,11 +55,11 @@ public function deleteEntityMetadataFromFolder($fileName, $folderName): void
if (Storage::disk($diskName)->exists($pathToFile)) {
try {
Storage::disk($diskName)->delete($pathToFile);
} catch (Exception $e) {
throw new InvalidArgumentException("Unable to delete file $pathToFile");
} catch (\Exception $e) {
throw new \InvalidArgumentException("Unable to delete file $pathToFile");
}
} else {
throw new InvalidArgumentException("Unable to delete file $pathToFile");
throw new \InvalidArgumentException("Unable to delete file $pathToFile");
}

}
Expand Down
3 changes: 1 addition & 2 deletions app/Services/NotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Notification;
use InvalidArgumentException;

class NotificationService
{
public static function sendModelNotification(Model $model, $notification): void
{
if (! method_exists($model, 'operators')) {
throw new InvalidArgumentException('The given model does not have an operators relationship.');
throw new \InvalidArgumentException('The given model does not have an operators relationship.');
}

$operators = $model->operators;
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/tinker": "^2.7",
"livewire/livewire": "^2.10"
"livewire/livewire": "^2.10",
"ext-http": "*"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",
Expand Down

0 comments on commit 8cf1423

Please sign in to comment.