Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Throw better exception when asset isn't found #11321

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

edalzell
Copy link
Contributor

@edalzell edalzell commented Jan 7, 2025

We are getting a ton of Call to a member function path() on null and it's coming from this code in Assets.php:

    public function process($data)
    {
        $max_files = (int) $this->config('max_files');

        $values = collect($data)->map(function ($id) {
            return Asset::find($id)->path();
        });

I'd like to know which asset is causing the issue, so let's throw a better exception.

@edalzell edalzell changed the title Throw better exception when asset isn't found [5.x] Throw better exception when asset isn't found Jan 7, 2025
@edalzell edalzell requested a review from jasonvarga January 7, 2025 19:32
@jasonvarga jasonvarga merged commit b63e958 into statamic:5.x Jan 7, 2025
19 of 20 checks passed
@edalzell edalzell deleted the fix/asset-not-found-exception branch January 7, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants