saveSvgAsPng
saveSvgAsPng copied to clipboard
How to handle error ?
There can be lot of reason for exception. (One example https://github.com/exupero/saveSvgAsPng/issues/199)
But I don't any way to handle error. A typical callback looks like cb(err, data)
. But in here the callback is cb(data)
and if the function throws any error, I can't put any try..catch
block as it's a callback operation. (async)
I not sure is this related https://github.com/exupero/saveSvgAsPng/pull/205 or not.
May be this tag will help
https://github.com/exupero/saveSvgAsPng/commit/79b2e640d424c6e16e18a772094ea1dda88e2ad4?diff=split
If the function you're calling returns a promise, you can attach an error-handling callback using the promise's .catch()
method. If the function you're calling doesn't return a promise, I'll update it.