unsplash-php icon indicating copy to clipboard operation
unsplash-php copied to clipboard

Bad error message when photo ID is missing

Open winternet-studio opened this issue 7 years ago • 1 comments

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 avatar Jan 26 '18 12:01 winternet-studio

@winternet-studio good point. Agree that we should catch that behaviour early and throw a more helpful error.

lukechesser avatar Jan 26 '18 18:01 lukechesser