Add more logs for IPFS failures
All checks were successful
Release Drafter / Update release notes draft (pull_request) Successful in 4s

This commit is contained in:
Râu Cao 2025-01-20 15:32:50 -05:00
parent f4634fe692
commit 6e9f565587
Signed by: raucao
GPG Key ID: 37036C356E56CC51
2 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,7 @@ class Contributor extends Record {
const jsonStr = contributor.serialize(); const jsonStr = contributor.serialize();
// console.log('Adding IPFS doc for', contributorAttr.account);
return this.ipfs return this.ipfs
.add(jsonStr) .add(jsonStr)
.then((ipfsHashAttr) => { .then((ipfsHashAttr) => {
@ -62,7 +63,11 @@ class Contributor extends Record {
ipfsHashAttr.hashSize, ipfsHashAttr.hashSize,
]; ];
// console.log('Adding onchain record for', contributorAttr.account);
return this.contract.addContributor(...contributor, callOptions); return this.contract.addContributor(...contributor, callOptions);
}).catch(err => {
console.log('Failed to add IPFS document:', err.message);
throw(err);
}); });
} }

View File

@ -9,6 +9,13 @@ class IPFS {
} }
this._config = config; this._config = config;
this._ipfsAPI = ipfsClient.create(config); this._ipfsAPI = ipfsClient.create(config);
this._ipfsAPI.id().then(res => {
console.debug('IPFS ID:', res.id);
}).catch(e => {
console.debug('IPFS config:', config);
console.warn('Failed to initialize IPFS:', e.message);
});
} }
async catAndMerge (contractData, deserialize) { async catAndMerge (contractData, deserialize) {