[DEV-1739] Correct except syntax in middleware.