pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.35k stars 102 forks source link

Improve error handling #39

Open pngwn opened 4 years ago

pngwn commented 4 years ago

Currently errors are a bit hit or miss: some get swallowed and there are silent and confusing failures (YAML parsing failures for example), other fail noisily but unhelpfully.

We should be recovering with helpful messages where possible and failing noisily but helpfully where that is not possible.

One key aspect fo this is trying to resolve paths to layouts and components and providing helpful messages when this fails. Figuring out relatives vs absolute paths will help here, as we can provide more descriptive messages in this case.

SHould be straightforward for the common cases.

kwshi commented 3 years ago

Relatedly, it would be nice if mdsvex were to display any messages generated by the remark/rehype plugins, as they otherwise go ignored/unnoticed.

pngwn commented 3 years ago

Yep, this would be the mechanism I'll use to log mdsvex errors, so printing those out should also print out errors/ messages from all plugins.