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

Unified Diff: go/src/infra/gae/libs/wrapper/gae/commonErrors/errors.go

Issue 1151473003: Better attempt at an appengine wrapper. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: better typecheck Created 5 years, 7 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
Index: go/src/infra/gae/libs/wrapper/gae/commonErrors/errors.go
diff --git a/go/src/infra/gae/libs/wrapper/gae/commonErrors/errors.go b/go/src/infra/gae/libs/wrapper/gae/commonErrors/errors.go
new file mode 100644
index 0000000000000000000000000000000000000000..9be66adda181e2a5f0c7cf0aab51ec2fe7be6d62
--- /dev/null
+++ b/go/src/infra/gae/libs/wrapper/gae/commonErrors/errors.go
@@ -0,0 +1,39 @@
+// 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 commonErrors
+
+import (
+ "reflect"
+
+ "appengine/datastore"
+ "appengine/memcache"
+ "appengine/taskqueue"
+)
+
+// Common errors originating from the GAE SDK
+var (
+ ErrCASConflictMC = memcache.ErrCASConflict
M-A Ruel 2015/05/27 00:27:11 Why the aliasing exactly?
iannucci 2015/05/27 02:40:57 So then you can BreakFeatures(commonErrors.Somethi
+ ErrNoStatsMC = memcache.ErrNoStats
+ ErrCacheMissMC = memcache.ErrCacheMiss
+ ErrNotStoredMC = memcache.ErrNotStored
+ ErrServerErrorMC = memcache.ErrServerError
+
+ ErrInvalidKeyDS = datastore.ErrInvalidKey
+ ErrConcurrentTransactionDS = datastore.ErrConcurrentTransaction
+ ErrNoSuchEntityDS = datastore.ErrNoSuchEntity
+ ErrInvalidEntityTypeDS = datastore.ErrInvalidEntityType
+
+ ErrTaskAlreadyAddedTQ = taskqueue.ErrTaskAlreadyAdded
+)
+
+// TODO(riannucci): Add common internal errors which originate from the
+// dev_appserver SDK
+
+// ErrFieldMismatchDS returns a datastore.ErrFieldMismatch struct filled with
+// the given specification
+func ErrFieldMismatchDS(structType reflect.Type, fieldName, reason string) error {
+ return &datastore.ErrFieldMismatch{
+ StructType: structType, FieldName: fieldName, Reason: reason}
M-A Ruel 2015/05/27 00:27:11 then one item per line.
iannucci 2015/05/27 02:40:57 done.
+}

Powered by Google App Engine
This is Rietveld 408576698