Skip to content

Commit

Permalink
Set errors
Browse files Browse the repository at this point in the history
  • Loading branch information
canack committed Jan 2, 2024
1 parent 115bd3c commit 6242d59
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/terminal/handler/ghtrigger/ghtrigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (m *ModelGithubTrigger) View() string {
}

func (m *ModelGithubTrigger) syncWorkflowContent() {
m.modelError.Reset()
m.modelError.SetProgressMessage(
fmt.Sprintf("[%s@%s] Fetching workflow contents...",
m.SelectedRepository.RepositoryName, m.SelectedRepository.BranchName))
Expand All @@ -293,6 +294,13 @@ func (m *ModelGithubTrigger) syncWorkflowContent() {
if err != nil {
m.modelError.SetError(err)
m.modelError.SetErrorMessage("Workflow contents cannot be fetched")
return
}

if workflowContent.Workflow == nil {
m.modelError.SetError(errors.New("workflow contents cannot be empty"))
m.modelError.SetErrorMessage("You have no workflow contents")
return
}

if len(workflowContent.Workflow.KeyVals) == 0 &&
Expand Down

0 comments on commit 6242d59

Please sign in to comment.