There was no checking of `err` here, and it seems a bit unusual to resolve a promise with an "error" field rather than rejecting the promise.