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

Add optional gracefull error handling #780

Closed
wants to merge 13 commits into from
Closed

Conversation

mhelaiwa
Copy link
Contributor

Add optional gracefull error handling through config/ziggy.php. This will enable the user to receive an error through the console without stopping app's execution and fallback to a specified url like #

<?php
// config/ziggy.php
return [
    ... 
    'errors' => [
        'graceful' => true,
        'fallback_url' => '#zzzzzz'
    ]
   ...
];

@bakerkretzmar bakerkretzmar self-assigned this Oct 21, 2024
@bakerkretzmar
Copy link
Collaborator

Thanks, really appreciate the PR. Going to decline to add this functionality at the moment for two main reasons. First, Laravel doesn't do this, and one of our main priorities with Ziggy is to match Laravel's route() helper behaviour as closely as possible (in this case that means erroring like Laravel does). Second, I don't think we'd actually want to 'fall back' to a different route in the case that Ziggy is passed a route that doesn't exist, because that shouldn't happen—if you're passing a missing route that's a bug and it should be corrected, or ideally caught and removed during testing, it's not a real world use case we need to accommodate. Thanks again!

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