等待运算符被跳过

await operator is being skipped

你能帮我解决我面临的问题吗?

我在下面附上了我的代码,点击按钮后,它发现了一个错误(如果有的话)但跳过了

await this.reloadGridsOnAction(contractItemSubSystemIDsList, responce, true);

这意味着它只是跳转到 catch (e)。 我需要它先重新加载我的网格。 感谢您的任何建议。

private async onAssignClick() {
  this.isChangeAssociationInProcess$.next(true);
  const ac = this.activeContractCell$.getValue()!;
  const PostAwardContractID = getColumnValue(ac.record, PropNames.PostAwardContractID);
  const { contractItemSubSystemIDsList, ContractItemSubSystemIDsMap } = this.prepareUpdateLists(true);

  const body = {
    ContractItemSubSystemIDsList: ContractItemSubSystemIDsMap,
    PostAwardContractID,
    IsFromCWP: +(this.currentItemsModeId$.getValue() === ItemsMode.CWP)
  };

  try {
    await ModalSpinner.instance.show("Assigning", async () => {
      const responce = await ErrorHandler.executeWithHandling(() => HttpService.instance.post(assignmentsUrl, body).asJson<Array<{
        [PropNames.ModuleItemID]: number,
        [PropNames.ConstructionSubSystemID]: number
      }>>());

      await this.reloadGridsOnAction(contractItemSubSystemIDsList, responce, true);
    });

    return true;
  } catch (e) {
    if (!e.isConflict) throw e;
    const response = await (e.response as HttpResponse).asJson<any>(true);

    return ModalChannelService.instance.confirm(
      `ASSIGN ITEMS`,
      (
        <div className="delete-modal-content">
          <p className="modal-question">{response.Message}</p>
          <div className="distribution-board">
            <div className="text-ellipsis">Please refresh the page to see correct values.</div>
          </div>
        </div>
      ),
      [
        { returnValue: false, content: "CANCEL" },
      ],
      "assign-subsystems-modal"
    );
  }
}

如果它像那样跳过你的代码,它很可能会抛出错误并直接进入陷阱。

如果你想一直执行这个块

await this.reloadGridsOnAction(contractItemSubSystemIDsList, responce, true);

您可能希望在 catch 之后有一个 finally 块。