Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch convert errors and warnings #102

Closed
simeonackermann opened this issue Dec 7, 2020 · 1 comment
Closed

Catch convert errors and warnings #102

simeonackermann opened this issue Dec 7, 2020 · 1 comment

Comments

@simeonackermann
Copy link
Contributor

Issue type: 🦄 Feature

Description

Currently its not possible to catch yarrrml2rml convert errors and warnings. My idea was to simply log these messages and return them if requested. I think its better then throw errors and exit the conversion, because we may want ignore the warnings.
I don't really know how others solve this issue, but I simply solved it for me with a static logger (based on js-logger) on my fork: https://github.com/simeonackermann/yarrrml-parser/tree/feature-logger

Usage is:

const y2r = new yarrrml();
...
if ( y2r.getLogger().has('error') ) {
   const logs = y2r.getLogger().getAll();
   ...
}

Shall I open a PR for this?

Existing features it breaks

nothing

@bjdmeest
Copy link
Collaborator

bjdmeest commented Dec 9, 2020

That looks great! We just need to verify that this works equally well for CLI and when using it as a library, feel free to open a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants