summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikita Belahlazau <nbeloglazov@google.com>2024-03-26 01:38:26 -0700
committerGitHub <noreply@github.com>2024-03-26 08:38:26 +0000
commitb25f453d7b4dc739d5e47a7a44df0d142f6d3409 (patch)
tree1d9a56af0b72241f091349c35bee4483946b3200
parentd8b94df81eca2ec3b1430178dca95abe1423c18b (diff)
downloadkythe-b25f453d7b4dc739d5e47a7a44df0d142f6d3409.tar.gz
feat(typescript_indexer): add flag to fail analysis on plugin error (#6079)
Instead of log-and-continue behavior on plugin error it will fail analysis. This way errors can be reported as analysis failures and become more visible during pipeline run. Additionally it will help testing where analysis will be flagged as failed earlier.
-rw-r--r--kythe/typescript/indexer.ts3
-rw-r--r--kythe/typescript/plugin_api.ts13
2 files changed, 9 insertions, 7 deletions
diff --git a/kythe/typescript/indexer.ts b/kythe/typescript/indexer.ts
index 7a425646b..fa120f649 100644
--- a/kythe/typescript/indexer.ts
+++ b/kythe/typescript/indexer.ts
@@ -2755,6 +2755,9 @@ export function index(compilationUnit: CompilationUnit, options: IndexingOptions
try {
plugin.index(indexingContext);
} catch (err) {
+ if (indexingContext.options.failAnalysisOnPluginError) {
+ throw err;
+ }
console.error(`Plugin ${plugin.name} errored:`, err);
}
}
diff --git a/kythe/typescript/plugin_api.ts b/kythe/typescript/plugin_api.ts
index ef34712ad..f40fc7796 100644
--- a/kythe/typescript/plugin_api.ts
+++ b/kythe/typescript/plugin_api.ts
@@ -82,17 +82,16 @@ export interface IndexingOptions {
readFile?: (path: string) => Buffer;
/**
- * When enabled emits 0-0 spans at the beginning of each file that represent
- * current module. By default 0-1 spans are emitted. Also this flag changes it
- * to emit `defines/implicit` edges instead of `defines/binding`.
- */
- emitZeroWidthSpansForModuleNodes?: boolean;
-
- /**
* When enabled, ref/call source anchors span identifiers instead of full
* call expressions when possible.
*/
emitRefCallOverIdentifier?: boolean;
+
+ /**
+ * When enabled any error thrown from any plugin gets propagated to the caller.
+ * Currently errors from plugins are logged without interrupting analysis.
+ */
+ failAnalysisOnPluginError?: boolean;
}