Catching more errors when compiling an XPath