How to use the apollo-server-core.formatApolloErrors function in apollo-server-core

To help you get started, we’ve selected a few apollo-server-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fanout / apollo-serverless-demo / src / subscriptions-transport-apollo / ApolloSubscriptionServerOptions.ts View on Github external
connection.formatResponse = (value: ExecutionResult) => {
        return {
          ...value,
          errors:
            value.errors &&
            formatApolloErrors([...value.errors], {
              debug: apolloServer.requestOptions.debug,
              formatter: apolloServer.requestOptions.formatError,
            }),
        };
      };
      let context: Context = apolloConfig.context
github apollographql / apollo-server / packages / apollo-server-express / src / ApolloServer.ts View on Github external
.catch(error => {
        if (error.status && error.expose) res.status(error.status);

        next(
          formatApolloErrors([error], {
            formatter: server.requestOptions.formatError,
            debug: server.requestOptions.debug,
          }),
        );
      });
  } else {
github fanout / apollo-serverless-demo / src / subscriptions-transport-apollo / ApolloSubscriptionServerOptions.ts View on Github external
}),
        };
      };
      let context: Context = apolloConfig.context
        ? apolloConfig.context
        : { connection };
      try {
        context =
          typeof apolloConfig.context === "function"
            ? await apolloConfig.context({
                connection,
                payload: message.payload,
              })
            : context;
      } catch (e) {
        throw formatApolloErrors([e], {
          debug: apolloServer.requestOptions.debug,
          formatter: apolloServer.requestOptions.formatError,
        })[0];
      }

      return { ...connection, context };
    },
    schema,