I think what you looking for is
Which is the “global” controller rescue for that error that sets the status code.