-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy patherrorHelper.ts
More file actions
197 lines (174 loc) · 5.04 KB
/
errorHelper.ts
File metadata and controls
197 lines (174 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { AgentErrorDefinition } from '@microsoft/agents-activity'
/**
* Error definitions for the CosmosDB storage system.
* This contains localized error codes for the CosmosDB storage subsystem of the AgentSDK.
*
* Each error definition includes an error code (starting from -100000), a description, and a help link
* pointing to an AKA link to get help for the given error.
*
* Usage example:
* ```
* throw ExceptionHelper.generateException(
* ReferenceError,
* Errors.MissingCosmosDbStorageOptions
* );
* ```
*/
export const Errors: { [key: string]: AgentErrorDefinition } = {
/**
* Error thrown when CosmosDbPartitionedStorageOptions is not provided.
*/
MissingCosmosDbStorageOptions: {
code: -100000,
description: 'CosmosDbPartitionedStorageOptions is required.'
},
/**
* Error thrown when endpoint in cosmosClientOptions is not provided.
*/
MissingCosmosEndpoint: {
code: -100001,
description: 'endpoint in cosmosClientOptions is required.'
},
/**
* Error thrown when neither key nor tokenProvider is provided in cosmosClientOptions.
*/
MissingCosmosCredentials: {
code: -100002,
description: 'key or tokenProvider in cosmosClientOptions is required.'
},
/**
* Error thrown when databaseId is not provided.
*/
MissingDatabaseId: {
code: -100003,
description: 'databaseId for CosmosDB is required.'
},
/**
* Error thrown when containerId is not provided.
*/
MissingContainerId: {
code: -100004,
description: 'containerId for CosmosDB is required.'
},
/**
* Error thrown when compatibilityMode is enabled with a keySuffix.
*/
InvalidCompatibilityModeWithKeySuffix: {
code: -100005,
description: 'compatibilityMode cannot be true while using a keySuffix.'
},
/**
* Error thrown when keySuffix contains invalid Row Key characters.
*/
InvalidKeySuffixCharacters: {
code: -100006,
description: 'Cannot use invalid Row Key characters: {keySuffix} in keySuffix'
},
/**
* Error thrown when keys are not provided for reading.
*/
MissingReadKeys: {
code: -100007,
description: 'Keys are required when reading.'
},
/**
* Error thrown when changes are not provided for writing.
*/
MissingWriteChanges: {
code: -100008,
description: 'Changes are required when writing.'
},
/**
* Error thrown when attempting to use a custom partition key path.
*/
UnsupportedCustomPartitionKeyPath: {
code: -100009,
description: 'Custom Partition Key Paths are not supported. {containerId} has a custom Partition Key Path of {partitionKeyPath}.'
},
/**
* Error thrown when the specified container is not found.
*/
ContainerNotFound: {
code: -100010,
description: 'Container {containerId} not found.'
},
/**
* Error thrown when the key parameter is missing in CosmosDbKeyEscape.
*/
MissingKeyParameter: {
code: -100011,
description: "The 'key' parameter is required.",
},
/**
* Error thrown when there is an error reading from the container (404 Not Found).
*/
ContainerReadNotFound: {
code: -100012,
description: 'Not Found'
},
/**
* Error thrown when there is an error reading from container (400 Bad Request).
*/
ContainerReadBadRequest: {
code: -100013,
description: 'Error reading from container. You might be attempting to read from a non-partitioned container or a container that does not use \'/id\' as the partitionKeyPath'
},
/**
* Error thrown when there is a general error reading from the container.
*/
ContainerReadError: {
code: -100014,
description: 'Error reading from container'
},
/**
* Error thrown when there is an error upserting a document.
*/
DocumentUpsertError: {
code: -100015,
description: 'Error upserting document'
},
/**
* Error thrown when there is an error deleting a document (404 Not Found).
*/
DocumentDeleteNotFound: {
code: -100016,
description: 'Not Found'
},
/**
* Error thrown when unable to delete a document.
*/
DocumentDeleteError: {
code: -100017,
description: 'Unable to delete document'
},
/**
* Error thrown when failing to initialize CosmosDB database/container.
*/
InitializationError: {
code: -100018,
description: 'Failed to initialize Cosmos DB database/container: {databaseId}/{containerId}'
},
/**
* Error thrown when maximum nesting depth is exceeded.
*/
MaxNestingDepthExceeded: {
code: -100019,
description: 'Maximum nesting depth of {maxDepth} exceeded. {additionalMessage}'
},
/**
* Error thrown when there is an eTag conflict during a storage operation.
*/
ETagConflict: {
code: -100020,
description: 'Unable to write \'{key}\' due to eTag conflict.'
},
/**
* Error thrown when attempting to create an item that already exists in storage.
*/
ItemAlreadyExists: {
code: -100021,
description: 'Unable to write \'{key}\' because it already exists.'
}
}