code: function WritableStreamDefaultControllerError(controller, e) {
    const stream = controller._controlledWritableStream;
  
    assert(stream._state === 'writable' || stream._state === 'closing');
  
    WritableStreamError(stream, e);
  
    controller._queue = [];
  }
docs: A client of WritableStreamDefaultController may use these functions directly to bypass state check.