RexT
104
2
General

Are type hint errors catchable in controller methods?

Posted 2 months ago by RexT

If I type hint a model instance into a controller method, e.g. show(User $id) and the instance does not exist, php throws an error. I'd like to catch that error and pass a 'resource not found' message back to the front end instead, is that possible?

Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.