atooni / remark-kroki-plugin

2 stars 3 forks source link

Unhandled errors caused crash in elder.js #1

Open vlisivka opened 3 years ago

vlisivka commented 3 years ago

Problem:

I use remark kroki plugin in elder.js static site generator for my blog. However, when I make a mistake, kroki plugin fails, and it crashes elder.js.

Expected behavior:

In case of an error in a diagram, the plugin should keep the diagram code as is, with the optional error message added at the end and the full error message logged to console.

Actual behavior:

Crash:

(node:45845) UnhandledPromiseRejectionWarning: Error: Unable to get image text from kroki
    at ImageBlock.<anonymous> (/home/vlisivka/workspace/vlisivka.github.io/node_modules/remark-kroki-plugin/dist/transform.js:56:27)
    at Generator.next (<anonymous>)
    at fulfilled (/home/vlisivka/workspace/vlisivka.github.io/node_modules/remark-kroki-plugin/dist/transform.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:45845) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:45845) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
atooni commented 3 years ago

Thanks for reporting this - I noticed this myself already, but didnt find time to fix it. Will try to have a look this week.