How to use the rsocket-flowable.Flowable.error function in rsocket-flowable

To help you get started, we’ve selected a few rsocket-flowable 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 rsocket / rsocket-js / packages / rsocket-core / src / RSocketMachine.js View on Github external
requestChannel(payloads: Flowable>): Flowable> {
    let error: ?Error;
    if (this._responder.requestChannel) {
      try {
        return this._responder.requestChannel(payloads);
      } catch (_error) {
        console.error('requestChannel threw an exception', _error);
        error = _error;
      }
    }
    return Flowable.error(error || new Error('not implemented'));
  }
github rsocket / rsocket-js / packages / rsocket-core / src / RSocketMachine.js View on Github external
requestStream(payload: Payload): Flowable> {
    let error: ?Error;
    if (this._responder.requestStream) {
      try {
        return this._responder.requestStream(payload);
      } catch (_error) {
        console.error('requestStream threw an exception', _error);
        error = _error;
      }
    }
    return Flowable.error(error || new Error('not implemented'));
  }
github rsocket / rsocket-rpc-js / rsocket-rpc-js / packages / core / src / RequestHandlingRSocket.js View on Github external
): Flowable> {
    try {
      if (payload.metadata == null) {
        return Flowable.error(new Error('metadata is empty'));
      }

      const service = getService(payload.metadata);
      const handler = this._registeredServices.get(service);

      if (handler == null) {
        return Flowable.error(new Error('can not find service ' + service));
      }

      return handler.requestStream(payload);
    } catch (error) {
      return Flowable.error(error);
    }
  }
github rsocket / rsocket-js / packages / rsocket-examples / src / SimpleCli.js View on Github external
requestChannel(
    payloads: Flowable>,
  ): Flowable> {
    return Flowable.error(new Error());
  }
github rsocket / rsocket-rpc-js / rsocket-rpc-js / packages / core / src / RequestHandlingRSocket.js View on Github external
requestStream(
    payload: Payload,
  ): Flowable> {
    try {
      if (payload.metadata == null) {
        return Flowable.error(new Error('metadata is empty'));
      }

      const service = getService(payload.metadata);
      const handler = this._registeredServices.get(service);

      if (handler == null) {
        return Flowable.error(new Error('can not find service ' + service));
      }

      return handler.requestStream(payload);
    } catch (error) {
      return Flowable.error(error);
    }
  }
github rsocket / rsocket-rpc-js / rsocket-rpc-js / packages / core / src / RequestHandlingRSocket.js View on Github external
new SwitchTransformOperator(s, (payload, flowable) => {
          if (payload.metadata === undefined || payload.metadata === null) {
            return Flowable.error(new Error('metadata is empty'));
          } else {
            const service = getService(payload.metadata);
            const handler = this._registeredServices.get(service);
            if (handler === undefined || handler === null) {
              return Flowable.error(
                new Error('can not find service ' + service),
              );
            } else {
              return handler.requestChannel(flowable);
            }
          }
        }),
    );
github rsocket / rsocket-js / packages / rsocket-core / src / RSocketMachine.js View on Github external
requestStream(payload: Payload): Flowable> {
    const leaseError = this._useLeaseOrError(this._requesterLeaseHandler);
    if (leaseError) {
      return Flowable.error(new Error(leaseError));
    }

    const streamId = this._getNextStreamId(this._receivers);

    return new Flowable(
      subscriber => {
        this._receivers.set(streamId, subscriber);
        let initialized = false;

        subscriber.onSubscribe({
          cancel: () => {
            this._receivers.delete(streamId);
            if (!initialized) {
              return;
            }
            const cancelFrame = {
github rsocket / rsocket-js / packages / rsocket-examples / src / SimpleServer.js View on Github external
requestChannel(
    payloads: Flowable>,
  ): Flowable> {
    return Flowable.error(new Error());
  }
github rsocket / rsocket-js / packages / rsocket-core / src / RSocketMachine.js View on Github external
requestChannel(payloads: Flowable>): Flowable> {
    const leaseError = this._useLeaseOrError(this._requesterLeaseHandler);
    if (leaseError) {
      return Flowable.error(new Error(leaseError));
    }

    const streamId = this._getNextStreamId(this._receivers);
    let payloadsSubscribed = false;
    return new Flowable(
      subscriber => {
        try {
          this._receivers.set(streamId, subscriber);

          let initialized = false;

          subscriber.onSubscribe({
            cancel: () => {
              this._receivers.delete(streamId);
              if (!initialized) {
                return;