@graphql-yoga/plugin-prometheus 6.11.2 → 6.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -91,6 +91,11 @@ function usePrometheus(options) {
91
91
  // If only it is Yoga, we calculate HTTP request time
92
92
  if (context.request) {
93
93
  return ({ result: document, context }) => {
94
+ if (document instanceof Error) {
95
+ // validation errors can be parse results
96
+ // graphql errors are also instances of errors
97
+ return;
98
+ }
94
99
  const operationAST = (0, graphql_1.getOperationAST)(document, context.params.operationName);
95
100
  const params = {
96
101
  document,
package/esm/index.js CHANGED
@@ -82,6 +82,11 @@ export function usePrometheus(options) {
82
82
  // If only it is Yoga, we calculate HTTP request time
83
83
  if (context.request) {
84
84
  return ({ result: document, context }) => {
85
+ if (document instanceof Error) {
86
+ // validation errors can be parse results
87
+ // graphql errors are also instances of errors
88
+ return;
89
+ }
85
90
  const operationAST = getOperationAST(document, context.params.operationName);
86
91
  const params = {
87
92
  document,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-yoga/plugin-prometheus",
3
- "version": "6.11.2",
3
+ "version": "6.11.3",
4
4
  "description": "Prometheus plugin for GraphQL Yoga.",
5
5
  "peerDependencies": {
6
6
  "graphql": "^15.2.0 || ^16.0.0",