Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
relay-compiler diagnostic errors logging improvements (#4574)
Summary: Couple of improvements to relay compiler error output to address issues from #4571 1. Update diagnostic.print_without_source() to no longer include character ranges since the formatting of startchar:endchar doesnt match the standard expectation of linenumber:character (and thus editors will interpret it wrong) 2. Updated the ValidationErrors to no longer enumerate all errors, and instead show the count (since the actual errors are shown above anyway) Pull Request resolved: #4574 Test Plan: Confirmed the new formatting of .print_without_source() is correct with no character ranges (tested via ValidationError since I'm not sure how to generate a DiagnosticsError, but this will no longer be triggered due to the summarization change): ``` [INFO] Querying files to compile... [INFO] [default] compiling... [ERROR] Error: ✖︎ The type `CustomMetric` has no field `test`. See https://relay.dev/docs/error-reference/unknown-field/ client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx:20:7 19 │ configuration_json 20 │ test │ ^^^^ 21 │ } [ERROR] Compilation failed. [ERROR] Unable to run relay compiler. Error details: Failed to build: - Validation errors: - The type `CustomMetric` has no field `test`. See https://relay.dev/docs/error-reference/unknown-field/: client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx ``` Confirmed the count shows instead of the individual errors now: ``` [INFO] Querying files to compile... [INFO] [default] compiling... [ERROR] Error: ✖︎ The type `CustomMetric` has no field `test`. See https://relay.dev/docs/error-reference/unknown-field/ client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx:20:7 19 │ configuration_json 20 │ test │ ^^^^ 21 │ } [ERROR] Compilation failed. [ERROR] Unable to run relay compiler. Error details: Failed to build: - Validation errors: 1 error(s) encountered above. ``` Also confirmed that config errors still showed up correctly: ``` [ERROR] Config `/Users/alex/dev/statsig/console/relay.config.js` is invalid: - The `schema` configured for project `default` does not exist at `./server/lib/graphql/schedma.graphql`. Reviewed By: alunyov Differential Revision: D52663262 Pulled By: captbaritone fbshipit-source-id: e2fcf98a3ace0a83aa73b2eaabeea10d1958b455
- Loading branch information