How to use the @marblejs/core.EventError function in @marblejs/core

To help you get started, we’ve selected a few @marblejs/core 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 marblejs / marble / packages / websockets / src / error / specs / ws-error.handler.spec.ts View on Github external
test('handles error if error$ is defined', () => {
    // given
    const client = { sendResponse: jest.fn() } as any as MarbleWebSocketClient;
    const error = new EventError({ type: 'EVENT' }, '');
    const error$: WsErrorEffect = event$ => event$.pipe(
      mapTo({ type: error.event.type, error: {} }),
    );

    // when
    handleEffectsError(defaultMetadata, client, error$)(error);

    // then
    expect(client.sendResponse).toHaveBeenCalled();
  });
github marblejs / marble / packages / websockets / src / error / specs / ws-error.effect.spec.ts View on Github external
test('returns stream of error events for defined error object', () => {
    // given
    const incomingEvent = { type: 'TEST_EVENT' };
    const error = new EventError(incomingEvent, 'Test error message', { errorData: 'test_error_data' });
    const outgoingEvent = {
      type: incomingEvent.type,
      error: {
        message: error.message,
        data: error.data,
      },
    };

    // then
    Marbles.assertEffect(error$, [
      ['--a--', { a: incomingEvent }],
      ['--b--', { b: outgoingEvent }],
    ], { meta: { error } });
  });
github marblejs / marble / packages / websockets / src / error / specs / ws-error.handler.spec.ts View on Github external
test('does nothing if error$ is undefined', () => {
    // given
    const client = { sendResponse: jest.fn() } as any as MarbleWebSocketClient;
    const error = new EventError({ type: 'EVENT' }, '');

    // when
    handleEffectsError(defaultMetadata, client, undefined)(error);

    // then
    expect(client.sendResponse).not.toHaveBeenCalled();
  });
});
github marblejs / marble / packages / middleware-io / src / io.event.middleware.ts View on Github external
catchError((error: IOError) => throwError(
            new EventError(event as any, error.message, error.data),
          )),
        )),