error handling for kwextractor