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

Add options.strict to ignore individual url parsing errors #1

Merged
merged 2 commits into from
Aug 22, 2018

Conversation

Left47
Copy link
Contributor

@Left47 Left47 commented Aug 16, 2018

HAQ throws an error and halts when it encounters an invalid url. This is problematic when using email apis that use template placeholders, since one invalid url can prevent the whole template from being processed.

Example: <a href='%unsubscribe_url%'>Unsubscribe</a>

Added strict:false as an option to catch/ignore parsing errors at the url level, and leave invalid urls untouched while processing the rest of the file.

@zoellner
Copy link
Owner

Thank you for the PR. I would suggest to wrap only the new URL() statement in the try/catch block and also check for err.code ERR_INVALID_URL instead of treating all errors the same way

@zoellner zoellner merged commit c42e5bf into zoellner:master Aug 22, 2018
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

Successfully merging this pull request may close these issues.

2 participants