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

Need some way to debug brew templates #41

Closed
vlsi opened this issue May 16, 2013 · 5 comments
Closed

Need some way to debug brew templates #41

vlsi opened this issue May 16, 2013 · 5 comments

Comments

@vlsi
Copy link

vlsi commented May 16, 2013

Current brew errors are hard to impossible to debug.

It might throw Error: Error (duplicate 'row.names' are not allowed) in your BRCODEs: and you are alone with the error.

The best I figured out is a binary search over the template source (just exclude half of the text) to identify the bad statement.

options(error=traceback), error=browser, error=recover do not help (I did not manage to figure out the failing line of code).

Nicer error reporting would be very handy.

@vlsi
Copy link
Author

vlsi commented May 16, 2013

Hm. Executing BRCODEs one-by-one allows to identify bad line, however proper backtrace would be still good.

@daroczig
Copy link
Member

I would suggest using BRCATCODE (<%= ... %>) over BRCODE tags that would report the error and its message at the exact place in the report. The is no sense in using BRCODE in most of the cases -- just for loops and conditional parts of the document. What you think about this?

@vlsi
Copy link
Author

vlsi commented May 18, 2013

Avoiding <% %> is a nice idea, however it still misses to trace error to the source location (line numbers, or/and local variables)

@daroczig
Copy link
Member

That's right. Unfortunately I have no further ideas how could I improve error reporting, but would love to hear your suggestions.

What also helps me to debug my reports is to check the structure of the returned object that also show the source code (command) beside the captured messages:

> str(Pandoc.brew(text = '<%=error%>'))
 **ERROR**^[object 'error' not found] 
List of 2
 $ :List of 2
  ..$ type   : chr "block"
  ..$ robject:List of 6
  .. ..$ src   : chr "error"
  .. ..$ result: NULL
  .. ..$ output: chr " **ERROR**^[object 'error' not found]"
  .. ..$ type  : chr "error"
  .. ..$ msg   :List of 3
  .. .. ..$ messages: NULL
  .. .. ..$ warnings: NULL
  .. .. ..$ errors  : chr "object 'error' not found"
  .. ..$ stdout: NULL
  .. ..- attr(*, "class")= chr "evals"
 $ :List of 4
  ..$ type  : chr "text"
  ..$ text  :List of 2
  .. ..$ raw : chr "\n"
  .. ..$ eval: chr "\n"
  ..$ chunks:List of 2
  .. ..$ raw : NULL
  .. ..$ eval: NULL
  ..$ msg   :List of 3
  .. ..$ messages: NULL
  .. ..$ warnings: NULL
  .. ..$ errors  : NULL

@daroczig
Copy link
Member

Please let me know if you would have any ideas to improve error reporting.

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