Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: lib/src/db/model_db_impl.dart

Issue 1774183002: Throw a StateError in case no model was registered for a given kind (Closed) Base URL: git@github.com:dart-lang/gcloud.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/db/model_db_impl.dart
diff --git a/lib/src/db/model_db_impl.dart b/lib/src/db/model_db_impl.dart
index 934242279ad5339ef500977bf2c4e4bbf791ef38..dc26f134eeb2601e6f39ccdb8340fc3d490079ca 100644
--- a/lib/src/db/model_db_impl.dart
+++ b/lib/src/db/model_db_impl.dart
@@ -61,7 +61,12 @@ class ModelDBImpl implements ModelDB {
Key key = namespace.emptyKey;
for (var element in datastoreKey.elements) {
var type = _type2ModelDesc[_kind2ModelDesc[element.kind]];
- assert (type != null);
+ if (type == null) {
+ throw new StateError(
+ 'Could not find a model associated with kind "${element.kind}". '
+ 'Please ensure a model class was annotated with '
+ '`@Kind(name: "${element.kind}")`.');
+ }
key = key.append(type, id: element.id);
}
return key;
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698