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

Unified Diff: service/rawdatastore/errors.go

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint Created 5 years, 5 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 | « service/rawdatastore/datastore_test.go ('k') | service/rawdatastore/generic_key.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/rawdatastore/errors.go
diff --git a/service/rawdatastore/errors.go b/service/rawdatastore/errors.go
new file mode 100644
index 0000000000000000000000000000000000000000..7ba1af9a406241630de7b8b6a84dafd95300183f
--- /dev/null
+++ b/service/rawdatastore/errors.go
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package rawdatastore
+
+import (
+ "fmt"
+ "reflect"
+
+ "google.golang.org/appengine/datastore"
+)
+
+// These errors are returned by various rawdatastore.Interface methods.
+var (
+ ErrInvalidEntityType = datastore.ErrInvalidEntityType
+ ErrInvalidKey = datastore.ErrInvalidKey
+ ErrNoSuchEntity = datastore.ErrNoSuchEntity
+ ErrConcurrentTransaction = datastore.ErrConcurrentTransaction
+ ErrQueryDone = datastore.Done
+
+ // ErrMetaFieldUnset is returned from DSPropertyLoadSaver.{Get,Set}Meta
+ // implementations when the specified meta key isn't set on the struct at
+ // all.
+ ErrMetaFieldUnset = fmt.Errorf("gae: meta field unset")
+)
+
+// ErrFieldMismatch is returned when a field is to be loaded into a different
+// type than the one it was stored from, or when a field is missing or
+// unexported in the destination struct.
+// StructType is the type of the struct pointed to by the destination argument
+// passed to Get or to Iterator.Next.
+type ErrFieldMismatch struct {
+ StructType reflect.Type
+ FieldName string
+ Reason string
+}
+
+func (e *ErrFieldMismatch) Error() string {
+ return fmt.Sprintf("gae: cannot load field %q into a %q: %s",
+ e.FieldName, e.StructType, e.Reason)
+}
« no previous file with comments | « service/rawdatastore/datastore_test.go ('k') | service/rawdatastore/generic_key.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698