wrapper handler to handle 404 and exceptions.