diff --git a/packages/flutter_availability/lib/src/service/local_data_interface.dart b/packages/flutter_availability/lib/src/service/local_data_interface.dart index b389adb..a1eb5c6 100644 --- a/packages/flutter_availability/lib/src/service/local_data_interface.dart +++ b/packages/flutter_availability/lib/src/service/local_data_interface.dart @@ -207,8 +207,7 @@ class LocalAvailabilityDataInterface implements AvailabilityDataInterface { return availabilities[index]; } } - // TODO(Joey): Throw proper exceptions here - throw Exception("Availability not found"); + throw AvailabilityNotFoundException(); } @override @@ -226,9 +225,7 @@ class LocalAvailabilityDataInterface implements AvailabilityDataInterface { return templates[index]; } } - // TODO(Joey): Add proper exceptions in the data interface and throw them - // here - throw Exception("Template not found"); + throw TemplateNotFoundException(); } int _id = 1; diff --git a/packages/flutter_availability_data_interface/lib/src/data_interface.dart b/packages/flutter_availability_data_interface/lib/src/data_interface.dart index 52359fe..7434dc0 100644 --- a/packages/flutter_availability_data_interface/lib/src/data_interface.dart +++ b/packages/flutter_availability_data_interface/lib/src/data_interface.dart @@ -1,6 +1,12 @@ import "package:flutter_availability_data_interface/src/models/availability.dart"; import "package:flutter_availability_data_interface/src/models/templates.dart"; +/// Exception thrown when the requested availability can not be found +class AvailabilityNotFoundException implements Exception {} + +/// Exception thrown when the requested template can not be found +class TemplateNotFoundException implements Exception {} + /// A base interface that defines the communication from the availability user /// story to its persistance solution. ///