add error catcher for ipfs
This commit is contained in:
parent
9c84f99598
commit
d2d2263bd2
@ -75,9 +75,13 @@ export default class FilesService extends BaseService {
|
|||||||
* @throws {Error} If file cannot be deleted
|
* @throws {Error} If file cannot be deleted
|
||||||
*/
|
*/
|
||||||
public async delete(uid: string) {
|
public async delete(uid: string) {
|
||||||
const fileToUnpin = await this.filesRepository.findOneByUid(uid);
|
try {
|
||||||
|
const fileToUnpin = await this.filesRepository.findOneByUid(uid);
|
||||||
const fileHash = fileToUnpin.file_path.substring(this.variables.PINATA_GATEWAY.length);
|
const fileHash = fileToUnpin.file_path.substring(this.variables.PINATA_GATEWAY.length);
|
||||||
await this.ipfsService.unpinFile(fileHash);
|
await this.ipfsService.unpinFile(fileHash);
|
||||||
|
} catch(error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
|
||||||
return this.filesRepository.delete(uid);
|
return this.filesRepository.delete(uid);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user