1 year ago

Are type hint errors catchable in controller methods?

Posted 1 year 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?


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