RexT
129
2
General

Are type hint errors catchable in controller methods?

Posted 4 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.