正在跳过等待运算符



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

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

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块。

最新更新