smarter parser error handling