throw if credit is undefined