fix(compiler-cli): Fix swallowed Error messages (#20846)
This commit fixes a bug in which non-formatted errors are silently dropped. Internal issue: b/67739418 PR Close #20846
This commit is contained in:

committed by
Jason Aden

parent
c2dbc55f11
commit
073f485c72
@ -869,17 +869,21 @@ function syntaxErrorToDiagnostics(error: Error): Diagnostic[] {
|
||||
source: SOURCE,
|
||||
code: DEFAULT_ERROR_CODE
|
||||
}));
|
||||
} else {
|
||||
if (isFormattedError(error)) {
|
||||
return [{
|
||||
messageText: error.message,
|
||||
chain: error.chain && diagnosticChainFromFormattedDiagnosticChain(error.chain),
|
||||
category: ts.DiagnosticCategory.Error,
|
||||
source: SOURCE,
|
||||
code: DEFAULT_ERROR_CODE,
|
||||
position: error.position
|
||||
}];
|
||||
}
|
||||
} else if (isFormattedError(error)) {
|
||||
return [{
|
||||
messageText: error.message,
|
||||
chain: error.chain && diagnosticChainFromFormattedDiagnosticChain(error.chain),
|
||||
category: ts.DiagnosticCategory.Error,
|
||||
source: SOURCE,
|
||||
code: DEFAULT_ERROR_CODE,
|
||||
position: error.position
|
||||
}];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
// Produce a Diagnostic anyway since we know for sure `error` is a SyntaxError
|
||||
return [{
|
||||
messageText: error.message,
|
||||
category: ts.DiagnosticCategory.Error,
|
||||
code: DEFAULT_ERROR_CODE,
|
||||
source: SOURCE,
|
||||
}];
|
||||
}
|
||||
|
Reference in New Issue
Block a user