Fixed error when read stream cannot be created and crash server

This commit is contained in:
Alex Tran 2022-02-12 22:42:59 -06:00
parent 8783af8fd0
commit 1f1831087b

View file

@ -146,6 +146,10 @@ export class AssetService {
file = createReadStream(asset.resizePath);
}
file.on('error', (error) => {
Logger.log(`Cannot create read stream ${error}`);
return new BadRequestException('Cannot Create Read Stream');
});
return new StreamableFile(file);
} else if (asset.type == AssetType.VIDEO) {
// Handle Handling Video