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

Side by Side Diff: service/datastore/errors.go

Issue 1286943002: impl/memory: Make queries self-validate (Closed) Base URL: https://github.com/luci/gae.git@add_datastore_testable
Patch Set: rebase Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « impl/memory/datastore_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package datastore 5 package datastore
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "reflect" 9 "reflect"
10 10
11 "google.golang.org/appengine/datastore" 11 "google.golang.org/appengine/datastore"
12 ) 12 )
13 13
14 // These errors are returned by various datastore.Interface methods. 14 // These errors are returned by various datastore.Interface methods.
15 var ( 15 var (
16 ErrInvalidEntityType = datastore.ErrInvalidEntityType 16 ErrInvalidEntityType = datastore.ErrInvalidEntityType
17 ErrInvalidKey = datastore.ErrInvalidKey 17 ErrInvalidKey = datastore.ErrInvalidKey
18 ErrNoSuchEntity = datastore.ErrNoSuchEntity 18 ErrNoSuchEntity = datastore.ErrNoSuchEntity
19 ErrConcurrentTransaction = datastore.ErrConcurrentTransaction 19 ErrConcurrentTransaction = datastore.ErrConcurrentTransaction
20 ErrQueryDone = datastore.Done
21 20
22 // ErrMetaFieldUnset is returned from PropertyLoadSaver.{Get,Set}Meta 21 // ErrMetaFieldUnset is returned from PropertyLoadSaver.{Get,Set}Meta
23 // implementations when the specified meta key isn't set on the struct a t 22 // implementations when the specified meta key isn't set on the struct a t
24 // all. 23 // all.
25 ErrMetaFieldUnset = fmt.Errorf("gae: meta field unset") 24 ErrMetaFieldUnset = fmt.Errorf("gae: meta field unset")
26 ) 25 )
27 26
28 // ErrFieldMismatch is returned when a field is to be loaded into a different 27 // ErrFieldMismatch is returned when a field is to be loaded into a different
29 // type than the one it was stored from, or when a field is missing or 28 // type than the one it was stored from, or when a field is missing or
30 // unexported in the destination struct. 29 // unexported in the destination struct.
31 // StructType is the type of the struct pointed to by the destination argument 30 // StructType is the type of the struct pointed to by the destination argument
32 // passed to Get or to Iterator.Next. 31 // passed to Get or to Iterator.Next.
33 type ErrFieldMismatch struct { 32 type ErrFieldMismatch struct {
34 StructType reflect.Type 33 StructType reflect.Type
35 FieldName string 34 FieldName string
36 Reason string 35 Reason string
37 } 36 }
38 37
39 func (e *ErrFieldMismatch) Error() string { 38 func (e *ErrFieldMismatch) Error() string {
40 return fmt.Sprintf("gae: cannot load field %q into a %q: %s", 39 return fmt.Sprintf("gae: cannot load field %q into a %q: %s",
41 e.FieldName, e.StructType, e.Reason) 40 e.FieldName, e.StructType, e.Reason)
42 } 41 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698