diff --git a/modules/legacy/modules/device_management/lib/src/core/data/datasources/do_not_disturb_remote_datasource_impl.dart b/modules/legacy/modules/device_management/lib/src/core/data/datasources/do_not_disturb_remote_datasource_impl.dart index c2a3187d..54677c65 100644 --- a/modules/legacy/modules/device_management/lib/src/core/data/datasources/do_not_disturb_remote_datasource_impl.dart +++ b/modules/legacy/modules/device_management/lib/src/core/data/datasources/do_not_disturb_remote_datasource_impl.dart @@ -1,3 +1,4 @@ +import 'package:dio/dio.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; import '../../../features/do_not_disturb/domain/do_not_disturb_period.dart'; @@ -19,6 +20,14 @@ class DoNotDisturbRemoteDatasourceImpl implements DoNotDisturbRemoteDatasource { ); final model = DoNotDisturbResponseDto.fromJson(response.data!); return _toEntity(model.item); + } on DioException catch (e) { + if (e.response?.statusCode == 404) { + return DoNotDisturbSchedule( + id: '', + deviceIdentificator: identificator, + ); + } + throw Exception('Error fetching do not disturb schedule'); } catch (_) { throw Exception('Error fetching do not disturb schedule'); }