@@ -848,7 +848,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
848
848
const user = await this . checkUser ( "getTeamMembersByProject" ) ;
849
849
if ( projectId ) {
850
850
const project = await this . projectsService . getProject ( user . id , projectId ) ;
851
- if ( project && project . teamId ) {
851
+ if ( project . teamId ) {
852
852
return await this . organizationService . listMembers ( user . id , project . teamId ) ;
853
853
}
854
854
}
@@ -978,7 +978,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
978
978
}
979
979
const envVarsPromise = this . envVarService . resolve ( workspace ) ;
980
980
const projectPromise = workspace . projectId
981
- ? this . projectsService . getProject ( user . id , workspace . projectId )
981
+ ? ApplicationError . notFoundToUndefined ( this . projectsService . getProject ( user . id , workspace . projectId ) )
982
982
: Promise . resolve ( undefined ) ;
983
983
984
984
await mayStartPromise ;
@@ -1593,9 +1593,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1593
1593
const user = await this . checkAndBlockUser ( "getPrebuildEvents" ) ;
1594
1594
1595
1595
const project = await this . projectsService . getProject ( user . id , projectId ) ;
1596
- if ( ! project ) {
1597
- throw new ApplicationError ( ErrorCodes . NOT_FOUND , "Project not found" ) ;
1598
- }
1599
1596
await this . guardProjectOperation ( user , projectId , "get" ) ;
1600
1597
1601
1598
const events = await this . projectsService . getPrebuildEvents ( user . id , project . cloneUrl ) ;
@@ -1612,9 +1609,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1612
1609
const user = await this . checkAndBlockUser ( "triggerPrebuild" ) ;
1613
1610
1614
1611
const project = await this . projectsService . getProject ( user . id , projectId ) ;
1615
- if ( ! project ) {
1616
- throw new ApplicationError ( ErrorCodes . NOT_FOUND , "Project not found" ) ;
1617
- }
1618
1612
await this . guardProjectOperation ( user , projectId , "update" ) ;
1619
1613
1620
1614
const branchDetails = ! ! branchName
@@ -2810,9 +2804,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
2810
2804
2811
2805
private async guardProjectOperation ( user : User , projectId : string , op : ResourceAccessOp ) : Promise < void > {
2812
2806
const project = await this . projectsService . getProject ( user . id , projectId ) ;
2813
- if ( ! project ) {
2814
- throw new ApplicationError ( ErrorCodes . NOT_FOUND , "Project not found" ) ;
2815
- }
2816
2807
// Anyone who can read a team's information (i.e. any team member) can manage team projects
2817
2808
await this . guardTeamOperation ( project . teamId , "get" , "not_implemented" ) ;
2818
2809
}
@@ -2954,10 +2945,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
2954
2945
2955
2946
const user = await this . checkAndBlockUser ( "cancelPrebuild" ) ;
2956
2947
2957
- const project = await this . projectsService . getProject ( user . id , projectId ) ;
2958
- if ( ! project ) {
2959
- throw new ApplicationError ( ErrorCodes . NOT_FOUND , "Project not found" ) ;
2960
- }
2948
+ await this . projectsService . getProject ( user . id , projectId ) ;
2961
2949
await this . guardProjectOperation ( user , projectId , "update" ) ;
2962
2950
2963
2951
const prebuild = await this . workspaceDb . trace ( ctx ) . findPrebuildByID ( prebuildId ) ;
0 commit comments