humanmade/hm-rewrite — pull request #8 by rmccue (2014-02-06 07:49:13+00:00)
Title: No way to bail from a request

If I register a rewrite for (e.g.) `/foo/(.+)`, I'd like to be able to check the value in my request callback and fall back to a 404 page if it's not set.

Setting `$wp->query_vars['error'] = '404';` will send the 404 status code, but doesn't stop HM Rewrite from hooking into the various pieces and taking over the request.

This could be handled via either a try-catch block around the request callback calls, or by checking the result of the calls and, if they return false, passing out of the stack before the request is hijacked.