Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return handleGenericError(ValidationError, "ValidationError: Details hidden.");
}
if (_.get(error, "name", null) === "UserInputError") {
return handleGenericError(UserInputError, "UserInputError: Details hidden.");
}
if (_.get(error, "name", null) === "AuthenticationError") {
return handleGenericError(AuthenticationError, "AuthenticationError: Details hidden.");
}
if (_.get(error, "name", null) === "ForbiddenError") {
return handleGenericError(ForbiddenError, "ForbiddenError: Details hidden.");
}
// Try to map other errors to Apollo predefined errors. Useful when writing pg-functions which cannot return a specific Error Object
if (error.message.indexOf("AUTH.THROW.USER_INPUT_ERROR") >= 0) {
logger.trace(error);
return new UserInputError("Bad user input.");
}
if (error.message.indexOf("AUTH.THROW.AUTHENTICATION_ERROR") >= 0) {
logger.trace(error);
return new AuthenticationError("Authentication required.");
}
if (error.message.indexOf("AUTH.THROW.FORBIDDEN_ERROR") >= 0) {
logger.trace(error);
return new ForbiddenError("Access forbidden.");
}
if (_.get(error, "name", null) === "ApolloError") {
return handleGenericError(ApolloError, "ApolloError: Details hidden.");
}
if (_.get(error, "name", null) === "GraphQLError") {
return handleGenericError(GraphQLError, "GraphQLError: Details hidden.");
}