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
fix(compiler): Improved error reporting of the static reflector. #9011
Conversation
@@ -175,14 +177,12 @@ export class MetadataCollector { | |||
// or | |||
// var [<identifier>[, <identifier}+] = <expression>; | |||
// are not supported. | |||
let varValue = { | |||
__symbolc: 'error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice typo fix :)
StaticReflector provides more context on errors reported by the collector. The metadata collector now records the line and character of the node that caused it to report the error. Includes other minor fixes to error reporting and a wording change. Fixes angular#8978 Closes angular#9011
@@ -390,7 +390,11 @@ export class StaticReflector implements ReflectorReader { | |||
return context; | |||
} | |||
case "error": | |||
throw new Error(expression['message']); | |||
let message = expression['message']; | |||
if (expression['line']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test for showing line/column numbers?
StaticReflector provides more context on errors reported by the collector. The metadata collector now records the line and character of the node that caused it to report the error. Includes other minor fixes to error reporting and a wording change. Fixes angular#8978 Closes angular#9011
StaticReflector provides more context on errors reported by the collector. The metadata collector now records the line and character of the node that caused it to report the error. Includes other minor fixes to error reporting and a wording change. Fixes angular#8978 Closes angular#9011
StaticReflector provides more context on errors reported by the collector. The metadata collector now records the line and character of the node that caused it to report the error. Includes other minor fixes to error reporting and a wording change. Fixes angular#8978 Closes angular#9011
StaticReflector provides more context on errors reported by the collector. The metadata collector now records the line and character of the node that caused it to report the error. Includes other minor fixes to error reporting and a wording change. Fixes angular#8978 Closes angular#9011
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
Errors generated by the
StaticReflector
used during offline compilation does not produce context to diagnose the reason the error occurred. E.g. #8978.What is the new behavior?
Improved the error message by including more information, including positional information and well as provide more context when the error message is generated.
Does this PR introduce a breaking change?
Other information:
StaticReflector provides more context on errors reported by the
collector.
The metadata collector now records the line and character of the node that
caused it to report the error.
Includes other minor fixes to error reporting and a wording change.