Skip to content

Commit 365442d

Browse files
committed
An attempt to start an instance when no engine is available will now lead to a user readable error instead of silently failing
1 parent 18e6fdf commit 365442d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

  • src/management-system-v2/app/(dashboard)/[environmentId]/(automation)/executions

src/management-system-v2/app/(dashboard)/[environmentId]/(automation)/executions/deployment-hook.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ function useDeployment(definitionId: string, initialData?: DeployedProcessInfo)
100100
});
101101

102102
const startInstance = async (versionId: string, variables: { [key: string]: any } = {}) => {
103-
if (engines?.length) {
104-
// TODO: in case of static deployment or different versions on different engines we will have
105-
// to check if the engine can actually be used to start an instance
106-
return await startInstanceOnMachine(definitionId, versionId, engines[0], variables, {
107-
processInitiator: session?.user.id,
108-
spaceIdOfProcessInitiator: space.spaceId,
109-
});
110-
}
103+
if (!engines?.length) return userError('No fitting engine found');
104+
105+
// TODO: in case of static deployment or different versions on different engines we will have
106+
// to check if the engine can actually be used to start an instance
107+
return await startInstanceOnMachine(definitionId, versionId, engines[0], variables, {
108+
processInitiator: session?.user.id,
109+
spaceIdOfProcessInitiator: space.spaceId,
110+
});
111111
};
112112

113113
const activeStates = ['PAUSED', 'RUNNING', 'READY', 'DEPLOYMENT-WAITING', 'WAITING'];
@@ -171,7 +171,8 @@ function useDeployment(definitionId: string, initialData?: DeployedProcessInfo)
171171
}
172172

173173
async function getStartForm(versionId: string) {
174-
if (!engines) return;
174+
if (!engines?.length) return userError('No fitting engine found');
175+
175176
try {
176177
// TODO: in case of static deployment or different versions on different engines we will have
177178
// to check if the engine can actually be used to start an instance

0 commit comments

Comments
 (0)