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

parseTags does not show any errors #90

Open
sj-1010 opened this issue May 4, 2023 · 1 comment
Open

parseTags does not show any errors #90

sj-1010 opened this issue May 4, 2023 · 1 comment

Comments

@sj-1010
Copy link

sj-1010 commented May 4, 2023

I am using the parseTags method to extract all the tags and get any meaningful errors if there are any issues in the template file. However it seems to simply swallow any errors and not expose them.

I have a codesandbox link here that I have forked from the live demo: https://codesandbox.io/s/easy-template-x-demo-forked-9bxcox?file=/index.ts
The Get Tags button is what loads all the tags. The content of the docx file I'm using is as follows:

{name}
address}
some text
{phone_no

I expect it to throw the MissingStartDelimiterError for address} and MissingCloseDelimiterError for {phone_no
However it simple parses the name tag and returns that.

@sj-1010
Copy link
Author

sj-1010 commented May 4, 2023

Some more context upon further investigation:

  • It does throw Can not join text nodes from separate paragraphs. error if two opening delimiters are in succession
  • We might be missing a case here where if the openedTag and openedDelimiter are not null we should throw an error for a missing close tag
  • The DelimiterSearcher#findDelimiters method does not take into account all the delimiters that are present. For example if your template only contains name}, the findDelimiters method returns an empty array

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

1 participant