Pass error to custom callback, if supplied.