mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
Merge pull request #333 from SyncrowIOT/SP-1430-be-api-request-returns-400-bad-request-instead-of-empty-array-when-community-has-no-devices-or-spaces
refactor: improve error handling for missing space in device listing
This commit is contained in:
@ -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 =
|
||||
|
Reference in New Issue
Block a user