Update src/renderer/src/windows/screenshot/ScreenshotSelection.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
SuYao 2025-12-15 02:10:18 +08:00 committed by GitHub
parent 9f16630512
commit 1ad083511a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,6 +63,14 @@ const ScreenshotSelection = () => {
ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
logger.info('Screenshot drawn on canvas')
}
img.onerror = (e) => {
logger.error('Failed to load screenshot image', { error: e, screenshotData });
// Optionally, notify the user or close the selection window gracefully
// For example, close the window:
if (window.electron && window.electron.ipcRenderer) {
window.electron.ipcRenderer.send(IpcChannel.Screenshot_CloseSelectionWindow);
}
}
img.src = screenshotData
}, [screenshotData])