add check if not space not found (#430)

This commit is contained in:
ZaydSkaff
2025-06-24 12:18:15 +03:00
committed by GitHub
parent f337e6c681
commit 0a1ccad120

View File

@ -333,7 +333,12 @@ export class SpaceService {
.andWhere('space.disabled = :disabled', { disabled: false });
const space = await queryBuilder.getOne();
if (!space) {
throw new HttpException(
`Space with ID ${spaceUuid} not found`,
HttpStatus.NOT_FOUND,
);
}
return new SuccessResponseDto({
message: `Space with ID ${spaceUuid} successfully fetched`,
data: space,
@ -343,7 +348,7 @@ export class SpaceService {
throw error; // If it's an HttpException, rethrow it
} else {
throw new HttpException(
'An error occurred while deleting the community',
'An error occurred while fetching the space',
HttpStatus.INTERNAL_SERVER_ERROR,
);
}