unsplash-php
unsplash-php copied to clipboard
Bad error message when photo ID is missing
If you do the following code:
$photo = \Crew\Unsplash\Photo::find(null);
$download_url = $photo->download();
This is of course a bad ID argument for the find() method but I did this by mistake and it took a while before I realized the issue because the only error message I got was this:
EXCEPTION
[]
File: .../vendor/crewlabs/unsplash/src/Endpoint.php
Line: 87
#0 .../vendor/crewlabs/unsplash/src/Photo.php(208): Crew\Unsplash\Endpoint::__callStatic('get', Array)
#1 .../models/Unsplash.php(88): Crew\Unsplash\Photo->download()
Would be nice if this could be caught and notified clearly.
@winternet-studio good point. Agree that we should catch that behaviour early and throw a more helpful error.