Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Bug 730708 trap and report errors#1

Merged
groovecoder merged 3 commits intomdn:masterfrom
lmorchard:bug-730708-handle-errors
Mar 13, 2012
Merged

Bug 730708 trap and report errors#1
groovecoder merged 3 commits intomdn:masterfrom
lmorchard:bug-730708-handle-errors

Conversation

@lmorchard
Copy link
Contributor

I may end up merging this myself, but I wanted to at least start trying to change to the same PR and review process we use on mozilla/kuma

Long story short, this code:

  1. traps exceptions in lots places where they weren't trapped before
  2. wraps those exceptions in objects, which describe where they happened in the process
  3. the wrapped errors are turned into log messages that are sent via headers in the kumascript HTTP response
  4. bug 733831 will unpack those log messages on the kuma side and display them in a useful way.

Also, this involves an update of the pegjs package used to parse kuma wiki documents. I'm not entirely happy with that, since it's a pre-release. But, it's the first release that supplies the character position where a macro was parsed, thus offering some context to kumascript macro errors.

Need the bleeding edge revision, since it exposes the current character
offset to parsing. That helps pass along more context to error
reporting.
* Collect errors during macro processing, wrap more bits try/catch

* Transmit errors as firelogger log messages

* Use a firelogger-compatible middleware to transport log messages in
  HTTP headers in the response

* Switch from `async.forEach` to `async.queue` in macro execution

* Make the template and loader classes configurable by name.
@groovecoder
Copy link
Contributor

I can take a look - I just need to go into my kumascript submodule, pull this branch, and restart kumascript?

@lmorchard
Copy link
Contributor Author

You should switch the kuma branch to the one in the other pull request, then do:

git submodule update --init --recursive

If you just update kumascript, you'll miss the config changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Seems nice to try to execute as much of the template as possible. Let's wait to decide until we get user feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the question here is what to render into the page when a macro fails. This code renders {{ FooTemplate }} if executing FooTemplate() fails with an error. That doesn't provide any context.

I'm wondering if there's something more useful to render here - such as a big red MindTouch-like error placeholder with a link to the anchor of a log message (to be rendered in the implementation of bug 733831). But, I'd want to make that inline error message configurable and localizable from kuma. So, that would probably be another template to worry about.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's point it out to the doc/template authors to see what they want.

groovecoder added a commit that referenced this pull request Mar 13, 2012
@groovecoder groovecoder merged commit 8ac8053 into mdn:master Mar 13, 2012
wbamberg pushed a commit that referenced this pull request Jun 9, 2017
Elchi3 pushed a commit that referenced this pull request Jun 13, 2017
escattone pushed a commit that referenced this pull request Jun 23, 2017
Enable the FileLoader to handle absolute paths for the macro root directory.
a2sheppy pushed a commit that referenced this pull request Apr 15, 2019
Updating my fork to master
escattone pushed a commit that referenced this pull request Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants