Right now, the Transformer expects the transformation handler to return a promise.
It would be a rather simple addition to also forward immediate return values and any exceptions just like the promise resolution values. Arguably, relying on immediate return values means that it can no longer handle concurrent operations and effectively mimics ReactPHP's ThroughStream. However, in particular throwing exceptions is a rather common use case (not necessarily intentionally) and it may make sense to also forward this as an error event accordingly.
Right now, the
Transformerexpects the transformation handler to return a promise.It would be a rather simple addition to also forward immediate return values and any exceptions just like the promise resolution values. Arguably, relying on immediate return values means that it can no longer handle concurrent operations and effectively mimics ReactPHP's ThroughStream. However, in particular throwing exceptions is a rather common use case (not necessarily intentionally) and it may make sense to also forward this as an
errorevent accordingly.