PalisadoesFoundation / talawa-admin

Admin portal for the Talawa Mobile App. Click on the link below to see our documentation
https://docs.talawa.io/
GNU General Public License v3.0
129 stars 528 forks source link

Complement GraphlQl Error Handling: Multiple Resolvers #1841

Open NamitBhutani opened 5 months ago

NamitBhutani commented 5 months ago

Is your feature request related to a problem? Please describe. The error handling for certain resolvers namely: createMember, createAdmin, createComment . They now return a userErrors array based on the error that occurred. example GraphQL definitions

 createAdmin(data: UserAndOrganizationInput!): CreateAdminPayload!
type CreateAdminPayload {
  user: AppUserProfile
  userErrors: [CreateAdminError!]!
}
union CreateAdminError = OrganizationMemberNotFoundError | OrganizationNotFoundError | UserNotAuthorizedError | UserNotFoundError

Below is an example of how errors are now returned from the resolvers -

if (!organization) {
    return {
      user: new AppUserProfile(),
      userErrors: [
        {
          __typename: "OrganizationNotFoundError",
          message: requestContext.translate(
            ORGANIZATION_NOT_FOUND_ERROR.MESSAGE,
          ),
        },
      ],
    };
  }

Describe the solution you'd like We need to update the repository to handle the new errors methodology for the given resolvers.

Additional context

  1. Refer the issue #1486 and the linked Pull Request to the issue.
  2. https://github.com/PalisadoesFoundation/talawa-docs/blob/develop/docs/developers/talawa-api/error-handling.md
  3. https://productionreadygraphql.com/2020-08-01-guide-to-graphql-errors/
github-actions[bot] commented 5 months ago

Congratulations on making your first Issue! :confetti_ball: If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.

github-actions[bot] commented 5 months ago

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

Cioppolo14 commented 5 months ago

@NamitBhutani Is this one you wanted to be assigned?

github-actions[bot] commented 4 months ago

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.