Skip to content

Commit d76bcac

Browse files
authored
Fix static website err handling & return after rollback, handle null contracts & null contract type in getNodeIdFromContractId (#4426)
1 parent ab92e79 commit d76bcac

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/grid_client/src/primitives/nodes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ class Nodes {
165165
return tfclient.contracts
166166
.get({ id: contractId })
167167
.then(contract => {
168+
if (!contract) {
169+
throw new ValidationError(`Contract with ID ${contractId} not found or has been deleted.`);
170+
}
171+
if (!contract.contractType) {
172+
throw new ValidationError(`Contract with ID ${contractId} has no contract type.`);
173+
}
168174
if (contract.contractType.nameContract)
169175
throw new ValidationError(`Couldn't get node id for this contract ${contractId}. It's a name contract.`);
170176
return contract.contractType?.nodeContract?.nodeId || contract.contractType?.rentContract?.nodeId;

packages/playground/src/weblets/tf_staticwebsite.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ async function deploy() {
226226
if (domain.value) {
227227
if (!selectionDetails.value?.domain?.enableSelectedDomain) {
228228
vm[0].customDomain = selectionDetails.value?.domain?.customDomain;
229+
finalize(vm);
229230
return;
230231
}
231232
@@ -239,11 +240,13 @@ async function deploy() {
239240
network: vm[0].interfaces[0].network,
240241
});
241242
finalize(vm);
243+
return;
242244
} catch (e) {
243245
layout.value.setStatus("deploy", "Rollbacking back due to fail to deploy gateway...");
244246
245247
await rollbackDeployment(grid!, name.value);
246248
layout.value.setStatus("failed", normalizeError(e, "Failed to deploy a Static Website instance."));
249+
return;
247250
}
248251
}
249252
finalize(vm);

0 commit comments

Comments
 (0)