Skip to content

Commit

Permalink
fix(base url): improve exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-infernal committed Dec 18, 2023
1 parent c060943 commit dad6351
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Exceptions/InvalidDiskException.php
Expand Up @@ -10,4 +10,9 @@ public static function urlIsMissing(): self
{
return new self('The selected disk does not have a defined url.');
}

public static function urlIsNotSet(): self
{
return new self('The selected disk url is empty');
}
}
4 changes: 4 additions & 0 deletions src/View/Components/ResponsiveImg.php
Expand Up @@ -274,6 +274,10 @@ public function getUrlBasePath(): string
throw InvalidDiskException::urlIsMissing();
}

if (empty($disk['url'])) {
throw InvalidDiskException::urlIsNotSet();
}

return $disk['url'];
}
}

0 comments on commit dad6351

Please sign in to comment.