refactor: improve error handling for missing space in device listing

This commit is contained in:
faris Aljohari
2025-04-14 13:24:40 +03:00
parent 5bc69f869d
commit 777105fc28
+2 -5
View File
@@ -25,11 +25,8 @@ export class SpaceDeviceService {
// Validate community, project, and fetch space including devices in a single query
const space = await this.validationService.fetchSpaceDevices(spaceUuid);
if (!space || !space.devices?.length) {
throw new HttpException(
'The space does not contain any devices.',
HttpStatus.BAD_REQUEST,
);
if (!space) {
throw new HttpException('Space not found', HttpStatus.NOT_FOUND);
}
const spaceHierarchy =