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

feat: add a reference to the node a rule failed on #1321

Merged
merged 10 commits into from
Jan 21, 2019
5 changes: 4 additions & 1 deletion lib/core/base/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ function getDefferedRule(rule, context, options) {
description: 'An error occured while running this rule',
message: err.message,
stack: err.stack,
error: err
error: err,
// Add a reference to the node the rule failed on for easier debugging.
// See https://github.com/dequelabs/axe-core/issues/1317.
node: err.node || null
});
// resolve
resolve(errResult);
Expand Down
2 changes: 2 additions & 0 deletions lib/core/base/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Check.prototype.run = function(node, options, context, resolve, reject) {
context
);
} catch (e) {
// Save a reference to the node we errored on for futher debugging.
e.node = node;
reject(e);
return;
}
Expand Down