In either of the following cases, such a discharge does not affect a debt or liability, founded upon a contract, unless it was owing, when the petition was presented, to a resident of the state; or the creditor has executed a consent to the discharge; or has appeared in the proceedings; or has received a dividend from the trustee:
N.Y. Debt. and Cred. Law § 84