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

anonymous Error #245

Closed
jaSunny opened this issue Aug 27, 2016 · 11 comments
Closed

anonymous Error #245

jaSunny opened this issue Aug 27, 2016 · 11 comments
Labels

Comments

@jaSunny
Copy link

jaSunny commented Aug 27, 2016

Hey!

First of all, great job. I really love this lib!

Now, when using a bit more sophisticated template I receive the following error message:

Error
    at Object.<anonymous> (/var/www/vhosts/blub/node_modules/docxtemplater/js/errors.js:8:21)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/vhosts/blub/node_modules/docxtemplater/js/docUtils.js:5:14)
    at Module._compile (module.js:556:32)

However, same works with a
template. Could there be settings or style which may be a problem to the docxtemplater parser?

@edi9999
Copy link
Member

edi9999 commented Aug 27, 2016

I think I saw the error once, but was not able to reproduce. What seems very strange is that this indicates that the error happens when we call require("./errors") but this happens at the time you require docxtemplater, so it makes no sense to me as to why this error would appear only sometimes and not everytime.

I will investigate a bit and tell you what I find out.

Can you try catch the error and console.log(JSON.stringify(e)) it ?

@edi9999
Copy link
Member

edi9999 commented Aug 27, 2016

It seems that we do not create custom Errors correctly. I have asked this stackoverflow question to get advice : http://stackoverflow.com/questions/39183506/extending-error-gives-wrong-stack-trace-information

@jaSunny
Copy link
Author

jaSunny commented Aug 28, 2016

👍 great thanks. Keep me posted. Again, great job!

Update:
Okay, I broke down the sophisticated template and it looks like the problem originates either from using:

  • bold
  • underlined
  • page break
  • "Title" text style
    with text paragraphs

@edi9999
Copy link
Member

edi9999 commented Aug 28, 2016

Fixed and published in 2.1.5 on npm (you now will be getting a more detailled error message, not a generic message)

@edi9999 edi9999 added the bug label Aug 30, 2016
@jaSunny
Copy link
Author

jaSunny commented Aug 31, 2016

hey! even after updating, this error still occurs

e.g. if
{key] is used due to a typo

@edi9999
Copy link
Member

edi9999 commented Aug 31, 2016

Is the error still anonymous?

Can you share the new stacktrace ?

@edi9999
Copy link
Member

edi9999 commented Aug 31, 2016

It is expected to throw an error when the template has issues (like an unclosed tag) and the error contains additional information about the error (you can console.log(JSON.stringify(e)) to see the properties of the error, which you can use to show then to your end users.

@jaSunny
Copy link
Author

jaSunny commented Sep 1, 2016

yep still an anonymous error with the same stack trace

@edi9999
Copy link
Member

edi9999 commented Sep 1, 2016

On what engine are your running docxtemplater ?

nodejs ? chrome ? firefox ?

which versions ?

I just tested on chrome and firefox, and all errors that I can create with docxtemplater are not anonymous.

Are you 100% sure that you correctly updated ?

@edi9999 edi9999 reopened this Sep 1, 2016
@jaSunny
Copy link
Author

jaSunny commented Sep 1, 2016

# node -v
v6.4.0
# npm ls
[..]
├─┬ docxtemplater@2.1.4
│ ├─┬ jszip@2.6.1
│ │ └── pako@1.0.3
│ └── memoizejs@0.1.1
[..]

@edi9999
Copy link
Member

edi9999 commented Sep 1, 2016

It should be 2.1.5

@edi9999 edi9999 closed this as completed Sep 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants