refactor(localize): ensure that translate plugin exceptions are not swallowed (#38536)
Previously, exceptions that were not `BabelParseError`s were just ignored. Such exceptions are most likely programming errors in the package. They are now re-thrown to ensure that the error is not hidden. PR Close #38536
This commit is contained in:
parent
81053d3160
commit
b8351f3b10
|
@ -35,6 +35,8 @@ export function makeEs2015TranslatePlugin(
|
|||
// since there must be something wrong with the structure of the AST generated
|
||||
// by Babel parsing a TaggedTemplateExpression.
|
||||
throw buildCodeFrameError(path, e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ export function makeEs5TranslatePlugin(
|
|||
} catch (e) {
|
||||
if (isBabelParseError(e)) {
|
||||
diagnostics.error(buildCodeFrameError(callPath, e));
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue