Expose error stack traces (#211)

This commit is contained in:
Misode
2022-03-11 00:05:24 +01:00
committed by GitHub
parent 4122991b3b
commit 7ab0ec2e7e
14 changed files with 131 additions and 31 deletions

View File

@@ -76,7 +76,11 @@ export function useCanvas({ size, draw, onDrag, onHover, onLeave }: {
canvas.current.height = s[1]
const img = ctx.getImageData(0, 0, s[0], s[1])
const ownCount = redrawCount.current += 1
await draw(img)
try {
await draw(img)
} catch (e) {
throw e
}
if (ownCount === redrawCount.current) {
ctx.putImageData(img, 0, 0)
}