1//  Copyright (c) 2014 Couchbase, Inc.
2//  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
3//  except in compliance with the License. You may obtain a copy of the License at
4//    http://www.apache.org/licenses/LICENSE-2.0
5//  Unless required by applicable law or agreed to in writing, software distributed under the
6//  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
7//  either express or implied. See the License for the specific language governing permissions
8//  and limitations under the License.
9
10package errors
11
12import ()
13
14// Error codes for all other datastores, e.g Mock
15
16func NewOtherDatastoreError(e error, msg string) Error {
17	return &err{level: EXCEPTION, ICode: 16000, IKey: "datastore.other.datastore_generic_error", ICause: e,
18		InternalMsg: "Error in datastore " + msg, InternalCaller: CallerN(1)}
19}
20
21func NewOtherNamespaceNotFoundError(e error, msg string) Error {
22	return &err{level: EXCEPTION, ICode: 16001, IKey: "datastore.other.namespace_not_found", ICause: e,
23		InternalMsg: "Namespace Not Found " + msg, InternalCaller: CallerN(1)}
24}
25
26func NewOtherKeyspaceNotFoundError(e error, msg string) Error {
27	return &err{level: EXCEPTION, ICode: 16002, IKey: "datastore.other.keyspace_not_found", ICause: e,
28		InternalMsg: "Keyspace Not Found " + msg, InternalCaller: CallerN(1)}
29}
30
31func NewOtherNotImplementedError(e error, msg string) Error {
32	return &err{level: EXCEPTION, ICode: 16003, IKey: "datastore.other.not_implemented", ICause: e,
33		InternalMsg: "Not Implemented " + msg, InternalCaller: CallerN(1)}
34}
35
36func NewOtherIdxNotFoundError(e error, msg string) Error {
37	return &err{level: EXCEPTION, ICode: 16004, IKey: "datastore.other.idx_not_found", ICause: e,
38		InternalMsg: "Index not found  " + msg, InternalCaller: CallerN(1)}
39}
40
41func NewOtherIdxNoDrop(e error, msg string) Error {
42	return &err{level: EXCEPTION, ICode: 16005, IKey: "datastore.other.idx_no_drop", ICause: e,
43		InternalMsg: "Index Cannot be dropped " + msg, InternalCaller: CallerN(1)}
44}
45
46func NewOtherNotSupportedError(e error, msg string) Error {
47	return &err{level: EXCEPTION, ICode: 16006, IKey: "datastore.other.not_supported", ICause: e,
48		InternalMsg: "Not supported for this datastore " + msg, InternalCaller: CallerN(1)}
49}
50
51func NewOtherKeyNotFoundError(e error, msg string) Error {
52	return &err{level: EXCEPTION, ICode: 16007, IKey: "datastore.other.key_not_found", ICause: e,
53		InternalMsg: "Key not found " + msg, InternalCaller: CallerN(1)}
54}
55
56func NewInferencerNotFoundError(e error, msg string) Error {
57	return &err{level: EXCEPTION, ICode: 16020, IKey: "datastore.other.inferencer_not_found", ICause: e,
58		InternalMsg: "Inferencer not found " + msg, InternalCaller: CallerN(1)}
59}
60
61func NewOtherNoBuckets(dsName string) Error {
62	return &err{level: EXCEPTION, ICode: 16021, IKey: "datastore.other.no_buckets",
63		InternalMsg: "Datastore " + dsName + "contains no buckets that contain scopes.", InternalCaller: CallerN(1)}
64}
65
66func NewStatUpdaterNotFoundError(e error) Error {
67	return &err{level: EXCEPTION, ICode: 16030, IKey: "datastore.other.statUpdater_not_found", ICause: e,
68		InternalMsg: "StatUpdater not found", InternalCaller: CallerN(1)}
69}
70