throw exception when escaping string