@@ -36,6 +36,7 @@ type DownloadStatus struct {
3636 // One of "success", "failure', or empty if Status not "completed"
3737 Conclusion string
3838 Path string
39+ Error string // Error message if Conclusion is "failure"
3940}
4041
4142type TickMsg time.Time
@@ -47,6 +48,7 @@ type DownloadMsg struct {
4748 Status string
4849 // One of "success", "failure',
4950 Conclusion string
51+ Error string
5052}
5153
5254func NewModel (client stainless.Client , ctx context.Context , build stainless.Build , branch string , downloadPaths map [stainless.Target ]string ) Model {
@@ -93,8 +95,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
9395
9496 case DownloadMsg :
9597 download := m .Downloads [msg .Target ]
96- download .Status = "completed"
98+ download .Status = msg . Status
9799 download .Conclusion = msg .Conclusion
100+ download .Error = msg .Error
98101 m .Downloads [msg .Target ] = download
99102
100103 case FetchBuildMsg :
@@ -141,10 +144,18 @@ func (m Model) downloadTarget(target stainless.Target) tea.Cmd {
141144 }
142145 err = PullOutput (outputRes .Output , outputRes .URL , outputRes .Ref , m .Branch , m .Downloads [target ].Path , console .NewGroup (true ))
143146 if err != nil {
144- console .Error (fmt .Sprintf ("Failed to download %s: %v" , target , err ))
145- return DownloadMsg {target , "completed" , "failure" }
147+ return DownloadMsg {
148+ Target : target ,
149+ Status : "completed" ,
150+ Conclusion : "failure" ,
151+ Error : err .Error (),
152+ }
153+ }
154+ return DownloadMsg {
155+ Target : target ,
156+ Status : "completed" ,
157+ Conclusion : "success" ,
146158 }
147- return DownloadMsg {target , "completed" , "success" }
148159 }
149160}
150161
0 commit comments