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

Suggestion: Return partly parsed data with the exception. #48

Open
ievgennaida opened this issue Apr 8, 2020 · 1 comment
Open

Suggestion: Return partly parsed data with the exception. #48

ievgennaida opened this issue Apr 8, 2020 · 1 comment

Comments

@ievgennaida
Copy link

According to the:
https://www.w3.org/TR/svg-paths/

The browser will render broken path data until the first error has occurred.

For example, for the path data string 'M 10,10 L 20,20,30', there is an odd number of parameters for the "L" command, which requires an even number of parameters. The user agent is required to draw the line from (10,10) to (20,20) and then perform error reporting since 'L 20 20' is the last correctly defined segment of the path data specification.

I would assume that lib should also have the possibility to return at least a valid part of the path data.

Is it possible to extend the exception with the partly parsed data?

@ievgennaida ievgennaida changed the title Improvment. Return partly parsed data. Suggestion: Return partly parsed data with the exception. Apr 8, 2020
@nfroidure
Copy link
Owner

@ievgennaida it would certainly make sense to do so feel free to PR.

Kaiido added a commit to Kaiido/svg-pathdata that referenced this issue Nov 17, 2021
Basically nfroidure#48 but not sure it's worth a PR.
Instead of throwing (which is not ok for our case), we store the error on `commands`.
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