How to use the apollo-server-errors.ApolloError function in apollo-server-errors

To help you get started, we’ve selected a few apollo-server-errors 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 commercetools / merchant-center-application-kit / packages / application-shell / src / components / application-shell / application-shell.spec.js View on Github external
beforeEach(() => {
    createGraphqlMockServer(xhrMock, {
      operationsByTarget: {
        mc: mocksForMc.createMockOperations({
          FetchLoggedInUser: {
            me: new ApolloError('Oops'),
          },
        }),
      },
    });
  });
  it('should render error page', async () => {
github GraphQLGuide / apollo-datasource-mongodb / src / datasource.js View on Github external
constructor(collection) {
    super()

    if (!isCollectionOrModel(collection)) {
      throw new ApolloError(
        'MongoDataSource constructor must be given a collection or Mongoose model'
      )
    }

    if (isModel(collection)) {
      this.model = collection
      this.collection = this.model.collection
    } else {
      this.collection = collection
    }
  }
github sysgears / apollo-universal-starter-kit / modules / payments / server-ts / stripe / subscription / resolvers.ts View on Github external
await StripeSubscription.editSubscription({
          userId: identity.id,
          active: false,
          stripeSourceId: null,
          stripeSubscriptionId: null,
          expiryMonth: null,
          expiryYear: null,
          last4: null,
          brand: null
        });

        return { active: false };
      } catch (e) {
        log.error(e);
        if (e.code === 'resource_missing') {
          throw new ApolloError(e.message, e.code);
        }
        throw new Error(e.message);
      }
    })
  },