feat: improve error handling

This commit is contained in:
karishmas6
2024-10-16 01:40:53 +05:30
parent 6062b10beb
commit c2356f066e

View File

@@ -44,7 +44,6 @@ class Run extends Model<RunAttributes, RunCreationAttributes> implements RunAttr
public async uploadBinaryOutputToMinioBucket(key: string, data: Buffer): Promise<void> { public async uploadBinaryOutputToMinioBucket(key: string, data: Buffer): Promise<void> {
const bucketName = 'maxun-run-screenshots'; const bucketName = 'maxun-run-screenshots';
try { try {
console.log(`Uploading to bucket ${bucketName} with key ${key}`); console.log(`Uploading to bucket ${bucketName} with key ${key}`);
await minioClient.putObject(bucketName, key, data, data.length, { 'Content-Type': 'image/png' }); await minioClient.putObject(bucketName, key, data, data.length, { 'Content-Type': 'image/png' });
@@ -52,6 +51,7 @@ class Run extends Model<RunAttributes, RunCreationAttributes> implements RunAttr
console.log(`Successfully uploaded to MinIO: minio://${bucketName}/${key}`); console.log(`Successfully uploaded to MinIO: minio://${bucketName}/${key}`);
} catch (error) { } catch (error) {
console.error(`Error uploading to MinIO bucket: ${bucketName} with key: ${key}`, error); console.error(`Error uploading to MinIO bucket: ${bucketName} with key: ${key}`, error);
throw error;
} }
} }