mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 13:13:44 +02:00
fix: throw dedicated exceptions rather than generic ones
This commit is contained in:
parent
1e33d2b7cb
commit
d765a7a0f8
2 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue