How to use the error/GenericError function in error

To help you get started, we’ve selected a few error 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 seznam / IMA.js-core / router / __tests__ / AbstractRouterSpec.js View on Github external
it('should handle "notFound" route', done => {
      let params = { error: new GenericError() };

      spyOn(router._routes, 'get').and.returnValue(route);

      spyOn(router, '_handle').and.returnValue(
        Promise.resolve({
          content: '',
          status: 200,
          error: params.error
        })
      );

      router
        .handleNotFound(params, options)
        .then(response => {
          expect(router._handle).toHaveBeenCalledWith(route, params, options);
          expect(response.error instanceof GenericError).toEqual(true);
github seznam / IMA.js-core / router / __tests__ / AbstractRouterSpec.js View on Github external
it('should return false for client error, which return status 5**', () => {
      let isClientError = router.isClientError(
        new GenericError('Server error', { status: 500 })
      );

      expect(isClientError).toEqual(false);
    });
github seznam / IMA.js-core / router / __tests__ / AbstractRouterSpec.js View on Github external
it('should return true for redirection, which return status 3**', () => {
      let isRedireciton = router.isRedirection(
        new GenericError('Redirection', {
          status: 300,
          url: 'http://www.example.com/redirect'
        })
      );

      expect(isRedireciton).toEqual(true);
    });
github seznam / IMA.js-core / router / __tests__ / AbstractRouterSpec.js View on Github external
it('should return true for client error, which return status 4**', () => {
      let isClientError = router.isClientError(
        new GenericError('Client error', { status: 404 })
      );

      expect(isClientError).toEqual(true);
    });
github seznam / IMA.js-core / router / __tests__ / AbstractRouterSpec.js View on Github external
it('should return true for client error, which return status 4**', () => {
      let isRedireciton = router.isRedirection(
        new GenericError('Client error', { status: 400 })
      );

      expect(isRedireciton).toEqual(false);
    });
github seznam / IMA.js-core / http / __tests__ / HttpAgentImplSpec.js View on Github external
spyOn(proxy, 'request').and.callFake(() => {
          return Promise.reject(new GenericError('', data.params));
        });