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];
|
return availabilities[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO(Joey): Throw proper exceptions here
|
throw AvailabilityNotFoundException();
|
||||||
throw Exception("Availability not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -226,9 +225,7 @@ class LocalAvailabilityDataInterface implements AvailabilityDataInterface {
|
||||||
return templates[index];
|
return templates[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO(Joey): Add proper exceptions in the data interface and throw them
|
throw TemplateNotFoundException();
|
||||||
// here
|
|
||||||
throw Exception("Template not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _id = 1;
|
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/availability.dart";
|
||||||
import "package:flutter_availability_data_interface/src/models/templates.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
|
/// A base interface that defines the communication from the availability user
|
||||||
/// story to its persistance solution.
|
/// story to its persistance solution.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue