pass res to callback on error