Skip to content

Commit 1920c17

Browse files
author
Michal Tichák
committed
OCTRL-1051: added error messages to CreateAutoEnvironment
1 parent c092647 commit 1920c17

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

core/environment/manager.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,19 @@ func (envs *Manager) CreateAutoEnvironment(workflowPath string, userVars map[str
12811281
} else {
12821282
log.WithError(err).Logf(logrus.FatalLevel, "environment creation failed")
12831283
env.sendEnvironmentEvent(&event.EnvironmentEvent{EnvironmentID: newEnvId.String(), Error: err})
1284+
the.EventWriterWithTopic(topic.Environment).WriteEvent(&evpb.Ev_EnvironmentEvent{
1285+
EnvironmentId: newId.String(),
1286+
State: "ERROR",
1287+
Error: err.Error(),
1288+
Message: "cannot create new environment", // GUI listens for this concrete string
1289+
LastRequestUser: lastRequestUser,
1290+
WorkflowTemplateInfo: &evpb.WorkflowTemplateInfo{
1291+
Path: workflowPath,
1292+
Public: workflowPublicInfo.IsPublic,
1293+
Name: workflowPublicInfo.Name,
1294+
Description: workflowPublicInfo.Description,
1295+
},
1296+
})
12841297
return
12851298
}
12861299

@@ -1330,6 +1343,23 @@ func (envs *Manager) CreateAutoEnvironment(workflowPath string, userVars map[str
13301343
if err != nil {
13311344
err = fmt.Errorf("cannot load workflow template: %w", err)
13321345
env.sendEnvironmentEvent(&event.EnvironmentEvent{EnvironmentID: env.Id().String(), Error: err})
1346+
1347+
log.WithError(err).Error("failed to load workflow")
1348+
1349+
the.EventWriterWithTopic(topic.Environment).WriteEvent(&evpb.Ev_EnvironmentEvent{
1350+
EnvironmentId: newId.String(),
1351+
State: "ERROR",
1352+
Error: err.Error(),
1353+
Message: "cannot load workflow", // GUI listens for this concrete string
1354+
LastRequestUser: lastRequestUser,
1355+
WorkflowTemplateInfo: &evpb.WorkflowTemplateInfo{
1356+
Path: workflowPath,
1357+
Public: workflowPublicInfo.IsPublic,
1358+
Name: workflowPublicInfo.Name,
1359+
Description: workflowPublicInfo.Description,
1360+
},
1361+
})
1362+
13331363
return
13341364
}
13351365

0 commit comments

Comments
 (0)