File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ export const MockProvisionerJob: TypesGen.ProvisionerJob = {
81
81
id : "test-provisioner-job" ,
82
82
status : "succeeded" ,
83
83
storage_source : "asdf" ,
84
+ completed_at : "2022-05-17T17:39:01.382927298Z" ,
84
85
}
85
86
86
87
export const MockFailedProvisionerJob : TypesGen . ProvisionerJob = {
Original file line number Diff line number Diff line change @@ -550,12 +550,13 @@ export const workspaceMachine = createMachine(
550
550
}
551
551
} ,
552
552
getResources : async ( context ) => {
553
- if ( context . workspace ) {
554
- const resources = await API . getWorkspaceResources ( context . workspace . latest_build . id )
555
- return resources
556
- } else {
557
- throw Error ( "Cannot fetch workspace resources without workspace" )
553
+ // If the job hasn't completed, fetching resources will result
554
+ // in an unfriendly error for the user.
555
+ if ( ! context . workspace ?. latest_build . job . completed_at ) {
556
+ return [ ]
558
557
}
558
+ const resources = await API . getWorkspaceResources ( context . workspace . latest_build . id )
559
+ return resources
559
560
} ,
560
561
getBuilds : async ( context ) => {
561
562
if ( context . workspace ) {
You can’t perform that action at this time.
0 commit comments