dev: log more information when app icon migration fails

This commit is contained in:
KernelDeimos 2024-12-18 09:34:14 -05:00
parent 880c2d2a59
commit eb181b2cd8

View File

@ -277,7 +277,7 @@ class AppIconService extends BaseService {
const filename = `${data.app_uid}-${size}.png`; const filename = `${data.app_uid}-${size}.png`;
console.log('FILENAME', filename); console.log('FILENAME', filename);
const data_url = data.data_url; const data_url = data.data_url;
const base64 = data_url.split(',')[1]; const [metadata, base64] = data_url.split(',');
const input = Buffer.from(base64, 'base64'); const input = Buffer.from(base64, 'base64');
// NOTE: A stream would be more ideal than a buffer here // NOTE: A stream would be more ideal than a buffer here
@ -292,12 +292,14 @@ class AppIconService extends BaseService {
} catch (e) { } catch (e) {
this.log.error('Failed to resize icon', { this.log.error('Failed to resize icon', {
app: data.app_uid, app: data.app_uid,
metadata,
size, size,
error: e, error: e,
}); });
return; return;
} }
try {
const sys_actor = await svc_su.get_system_actor(); const sys_actor = await svc_su.get_system_actor();
const hl_write = new HLWrite(); const hl_write = new HLWrite();
await hl_write.run({ await hl_write.run({
@ -315,6 +317,14 @@ class AppIconService extends BaseService {
stream: buffer_to_stream(output), stream: buffer_to_stream(output),
}, },
}); });
} catch (e) {
this.log.error('Failed to write icon', {
app: data.app_uid,
metadata,
size,
error: e,
});
}
}) })
})()); })());
} }