writer.fail(reason)


将写入器置于终端错误状态。如果写入器已关闭或出错,则此操作无效。与 write()end() 不同,fail() 是无条件同步的,因为使写入器失败仅是一个纯状态转换,不涉及任何异步操作。

🌐 Put the writer into a terminal error state. If the writer is already closed or errored, this is a no-op. Unlike write() and end(), fail() is unconditionally synchronous because failing a writer is a pure state transition with no async work to perform.