How to use the apollo-server-express.toApolloError function in apollo-server-express

To help you get started, we’ve selected a few apollo-server-express 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 terascope / teraslice / packages / data-access-plugin / src / manager / utils.ts View on Github external
error = new apollo.AuthenticationError(message);
            } else if (statusCode === 403) {
                error = new apollo.ForbiddenError(message);
            } else {
                error = new apollo.UserInputError(message);
            }

            if (err && err.stack) {
                if (removeUserStack) {
                    error.stack = undefined;
                } else {
                    error.stack = err.stack;
                }
            }
        } else {
            error = apollo.toApolloError(err, code);
        }

        return error;
    };
}