Fixed wrong error getting thrown

ref #112
This commit is contained in:
Nicolai Ort 2021-01-21 19:51:40 +01:00
parent 10f98e9c99
commit 6469e3bc97

View File

@ -48,7 +48,8 @@ export class CreateSelfServiceRunner extends CreateParticipant {
return group;
}
const team = await getConnection().getRepository(RunnerTeam).findOne({ id: this.team }, { relations: ["parentGroup"] });
if (team.parentGroup.id != group.id || !team) { throw new RunnerTeamNotFoundError(); }
if (!team) { throw new RunnerTeamNotFoundError(); }
if (team.parentGroup.id != group.id) { throw new RunnerTeamNotFoundError(); }
return team;
}
}