restforce 4.2.1 → 5.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +14 -9
- data/.github/ISSUE_TEMPLATE/unhandled-salesforce-error.md +17 -0
- data/.github/dependabot.yml +19 -0
- data/.rubocop.yml +5 -4
- data/CHANGELOG.md +96 -0
- data/CONTRIBUTING.md +21 -1
- data/Dockerfile +31 -0
- data/Gemfile +10 -7
- data/README.md +94 -21
- data/UPGRADING.md +38 -0
- data/docker-compose.yml +7 -0
- data/lib/restforce/abstract_client.rb +1 -0
- data/lib/restforce/collection.rb +27 -4
- data/lib/restforce/concerns/api.rb +2 -2
- data/lib/restforce/concerns/base.rb +2 -2
- data/lib/restforce/concerns/caching.rb +7 -0
- data/lib/restforce/concerns/composite_api.rb +104 -0
- data/lib/restforce/concerns/picklists.rb +2 -2
- data/lib/restforce/concerns/streaming.rb +1 -3
- data/lib/restforce/config.rb +4 -1
- data/lib/restforce/error_code.rb +647 -0
- data/lib/restforce/file_part.rb +24 -0
- data/lib/restforce/mash.rb +8 -3
- data/lib/restforce/middleware/caching.rb +1 -1
- data/lib/restforce/middleware/logger.rb +8 -7
- data/lib/restforce/middleware/raise_error.rb +3 -4
- data/lib/restforce/middleware.rb +2 -0
- data/lib/restforce/version.rb +1 -1
- data/lib/restforce.rb +6 -7
- data/restforce.gemspec +11 -20
- data/spec/fixtures/sobject/list_view_results_success_response.json +151 -0
- data/spec/integration/abstract_client_spec.rb +41 -32
- data/spec/integration/data/client_spec.rb +6 -2
- data/spec/spec_helper.rb +24 -1
- data/spec/support/client_integration.rb +7 -7
- data/spec/support/concerns.rb +1 -1
- data/spec/support/fixture_helpers.rb +1 -3
- data/spec/support/middleware.rb +1 -2
- data/spec/unit/collection_spec.rb +38 -2
- data/spec/unit/concerns/api_spec.rb +11 -11
- data/spec/unit/concerns/authentication_spec.rb +6 -6
- data/spec/unit/concerns/caching_spec.rb +26 -0
- data/spec/unit/concerns/composite_api_spec.rb +143 -0
- data/spec/unit/concerns/connection_spec.rb +2 -2
- data/spec/unit/concerns/streaming_spec.rb +4 -4
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/error_code_spec.rb +61 -0
- data/spec/unit/mash_spec.rb +5 -0
- data/spec/unit/middleware/authentication/jwt_bearer_spec.rb +4 -4
- data/spec/unit/middleware/authentication/password_spec.rb +2 -2
- data/spec/unit/middleware/authentication/token_spec.rb +2 -2
- data/spec/unit/middleware/authentication_spec.rb +11 -5
- data/spec/unit/middleware/gzip_spec.rb +2 -2
- data/spec/unit/middleware/raise_error_spec.rb +29 -10
- data/spec/unit/signed_request_spec.rb +1 -1
- metadata +41 -125
- data/lib/restforce/upload_io.rb +0 -9
@@ -0,0 +1,647 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Restforce
|
4
|
+
module ErrorCode
|
5
|
+
GITHUB_ISSUE_URL = "https://github.com/restforce/restforce/issues/new?template=" \
|
6
|
+
"unhandled-salesforce-error.md&title=Unhandled+Salesforce+error" \
|
7
|
+
"%3A+%3Cinsert+error+code+here%3E"
|
8
|
+
|
9
|
+
# We define all of the known errors returned by Salesforce based on the
|
10
|
+
# documentation at
|
11
|
+
# https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#statuscode
|
12
|
+
# Previously, these were defined dynamically at runtime using `Module.const_set`. Now
|
13
|
+
# we define them up-front.
|
14
|
+
# It is possible that we will be missing some errors, so we will handle this in
|
15
|
+
# at least a semi-graceful manner.
|
16
|
+
class AllOrNoneOperationRolledBack < ResponseError; end
|
17
|
+
|
18
|
+
class AlreadyInProcess < ResponseError; end
|
19
|
+
|
20
|
+
class ApexError < ResponseError; end
|
21
|
+
|
22
|
+
class ApiCurrentlyDisabled < ResponseError; end
|
23
|
+
|
24
|
+
class ApiDisabledForOrg < ResponseError; end
|
25
|
+
|
26
|
+
class AssigneeTypeRequired < ResponseError; end
|
27
|
+
|
28
|
+
class BadCustomEntityParentDomain < ResponseError; end
|
29
|
+
|
30
|
+
class BccNotAllowedIfBccComplianceEnabled < ResponseError; end
|
31
|
+
|
32
|
+
class BccSelfNotAllowedIfBccComplianceEnabled < ResponseError; end
|
33
|
+
|
34
|
+
class BigObjectUnsupportedOperation < ResponseError; end
|
35
|
+
|
36
|
+
class CannotCascadeProductActive < ResponseError; end
|
37
|
+
|
38
|
+
class CannotChangeFieldTypeOfApexReferencedField < ResponseError; end
|
39
|
+
|
40
|
+
class CannotCreateAnotherManagedPackage < ResponseError; end
|
41
|
+
|
42
|
+
class CannotDeactivateDivision < ResponseError; end
|
43
|
+
|
44
|
+
class CannotDeleteLastDatedConversionRate < ResponseError; end
|
45
|
+
|
46
|
+
class CannotDeleteManagedObject < ResponseError; end
|
47
|
+
|
48
|
+
class CannotDisableLastAdmin < ResponseError; end
|
49
|
+
|
50
|
+
class CannotEnableIpRestrictRequests < ResponseError; end
|
51
|
+
|
52
|
+
class CannotExecuteFlowTrigger < ResponseError; end
|
53
|
+
|
54
|
+
class CannotInsertUpdateActivateEntity < ResponseError; end
|
55
|
+
|
56
|
+
class CannotModifyManagedObject < ResponseError; end
|
57
|
+
|
58
|
+
class CannotRenameApexReferencedField < ResponseError; end
|
59
|
+
|
60
|
+
class CannotRenameApexReferencedObject < ResponseError; end
|
61
|
+
|
62
|
+
class CannotReparentRecord < ResponseError; end
|
63
|
+
|
64
|
+
class CannotResolveName < ResponseError; end
|
65
|
+
|
66
|
+
class CannotUpdateConvertedLead < ResponseError; end
|
67
|
+
|
68
|
+
class CantDisableCorpCurrency < ResponseError; end
|
69
|
+
|
70
|
+
class CantUnsetCorpCurrency < ResponseError; end
|
71
|
+
|
72
|
+
class ChildShareFailsParent < ResponseError; end
|
73
|
+
|
74
|
+
class CircularDependency < ResponseError; end
|
75
|
+
|
76
|
+
class CommunityNotAccessible < ResponseError; end
|
77
|
+
|
78
|
+
class CustomClobFieldLimitExceeded < ResponseError; end
|
79
|
+
|
80
|
+
class CustomEntityOrFieldLimit < ResponseError; end
|
81
|
+
|
82
|
+
class CustomFieldIndexLimitExceeded < ResponseError; end
|
83
|
+
|
84
|
+
class CustomIndexExists < ResponseError; end
|
85
|
+
|
86
|
+
class CustomLinkLimitExceeded < ResponseError; end
|
87
|
+
|
88
|
+
class CustomMetadataLimitExceeded < ResponseError; end
|
89
|
+
|
90
|
+
class CustomSettingsLimitExceeded < ResponseError; end
|
91
|
+
|
92
|
+
class CustomTabLimitExceeded < ResponseError; end
|
93
|
+
|
94
|
+
class DeleteFailed < ResponseError; end
|
95
|
+
|
96
|
+
class DependencyExists < ResponseError; end
|
97
|
+
|
98
|
+
class DuplicateCaseSolution < ResponseError; end
|
99
|
+
|
100
|
+
class DuplicateCustomEntityDefinition < ResponseError; end
|
101
|
+
|
102
|
+
class DuplicateCustomTabMotif < ResponseError; end
|
103
|
+
|
104
|
+
class DuplicateDeveloperName < ResponseError; end
|
105
|
+
|
106
|
+
class DuplicatesDetected < ResponseError; end
|
107
|
+
|
108
|
+
class DuplicateExternalId < ResponseError; end
|
109
|
+
|
110
|
+
class DuplicateMasterLabel < ResponseError; end
|
111
|
+
|
112
|
+
class DuplicateSenderDisplayName < ResponseError; end
|
113
|
+
|
114
|
+
class DuplicateUsername < ResponseError; end
|
115
|
+
|
116
|
+
class DuplicateValue < ResponseError; end
|
117
|
+
|
118
|
+
class EmailAddressBounced < ResponseError; end
|
119
|
+
|
120
|
+
class EmailNotProcessedDueToPriorError < ResponseError; end
|
121
|
+
|
122
|
+
class EmailOptedOut < ResponseError; end
|
123
|
+
|
124
|
+
class EmailTemplateFormulaError < ResponseError; end
|
125
|
+
|
126
|
+
class EmailTemplateMergefieldAccessError < ResponseError; end
|
127
|
+
|
128
|
+
class EmailTemplateMergefieldError < ResponseError; end
|
129
|
+
|
130
|
+
class EmailTemplateMergefieldValueError < ResponseError; end
|
131
|
+
|
132
|
+
class EmailTemplateProcessingError < ResponseError; end
|
133
|
+
|
134
|
+
class EmptyScontrolFileName < ResponseError; end
|
135
|
+
|
136
|
+
class EntityFailedIflastmodifiedOnUpdate < ResponseError; end
|
137
|
+
|
138
|
+
class EntityIsArchived < ResponseError; end
|
139
|
+
|
140
|
+
class EntityIsDeleted < ResponseError; end
|
141
|
+
|
142
|
+
class EntityIsLocked < ResponseError; end
|
143
|
+
|
144
|
+
class EnvironmentHubMembershipConflict < ResponseError; end
|
145
|
+
|
146
|
+
class ErrorInMailer < ResponseError; end
|
147
|
+
|
148
|
+
class ExceededMaxSemijoinSubselects < ResponseError; end
|
149
|
+
|
150
|
+
class FailedActivation < ResponseError; end
|
151
|
+
|
152
|
+
class FieldCustomValidationException < ResponseError; end
|
153
|
+
|
154
|
+
class FieldFilterValidationException < ResponseError; end
|
155
|
+
|
156
|
+
class FieldIntegrityException < ResponseError; end
|
157
|
+
|
158
|
+
class FilteredLookupLimitExceeded < ResponseError; end
|
159
|
+
|
160
|
+
class Forbidden < ResponseError; end
|
161
|
+
|
162
|
+
class HtmlFileUploadNotAllowed < ResponseError; end
|
163
|
+
|
164
|
+
class IllegalQueryParameterValue < ResponseError; end
|
165
|
+
|
166
|
+
class ImageTooLarge < ResponseError; end
|
167
|
+
|
168
|
+
class InactiveOwnerOrUser < ResponseError; end
|
169
|
+
|
170
|
+
class InsertUpdateDeleteNotAllowedDuringMaintenance < ResponseError; end
|
171
|
+
|
172
|
+
class InsufficientAccessOnCrossReferenceEntity < ResponseError; end
|
173
|
+
|
174
|
+
class InsufficientAccessOrReadonly < ResponseError; end
|
175
|
+
|
176
|
+
class InvalidAccessLevel < ResponseError; end
|
177
|
+
|
178
|
+
class InvalidArgumentType < ResponseError; end
|
179
|
+
|
180
|
+
class InvalidAssigneeType < ResponseError; end
|
181
|
+
|
182
|
+
class InvalidAssignmentRule < ResponseError; end
|
183
|
+
|
184
|
+
class InvalidBatchOperation < ResponseError; end
|
185
|
+
|
186
|
+
class InvalidContentType < ResponseError; end
|
187
|
+
|
188
|
+
class InvalidCreditCardInfo < ResponseError; end
|
189
|
+
|
190
|
+
class InvalidCrossReferenceKey < ResponseError; end
|
191
|
+
|
192
|
+
class InvalidCrossReferenceTypeForField < ResponseError; end
|
193
|
+
|
194
|
+
class InvalidCurrencyConvRate < ResponseError; end
|
195
|
+
|
196
|
+
class InvalidCurrencyCorpRate < ResponseError; end
|
197
|
+
|
198
|
+
class InvalidCurrencyIso < ResponseError; end
|
199
|
+
|
200
|
+
class InvalidEmailAddress < ResponseError; end
|
201
|
+
|
202
|
+
class InvalidEmptyKeyOwner < ResponseError; end
|
203
|
+
|
204
|
+
class InvalidEventSubscription < ResponseError; end
|
205
|
+
|
206
|
+
class InvalidField < ResponseError; end
|
207
|
+
|
208
|
+
class InvalidFieldForInsertUpdate < ResponseError; end
|
209
|
+
|
210
|
+
class InvalidFieldWhenUsingTemplate < ResponseError; end
|
211
|
+
|
212
|
+
class InvalidFilterAction < ResponseError; end
|
213
|
+
|
214
|
+
class InvalidIdField < ResponseError; end
|
215
|
+
|
216
|
+
class InvalidInetAddress < ResponseError; end
|
217
|
+
|
218
|
+
class InvalidLineitemCloneState < ResponseError; end
|
219
|
+
|
220
|
+
class InvalidMasterOrTranslatedSolution < ResponseError; end
|
221
|
+
|
222
|
+
class InvalidMessageIdReference < ResponseError; end
|
223
|
+
|
224
|
+
class InvalidOperation < ResponseError; end
|
225
|
+
|
226
|
+
class InvalidOperationWithExpiredPassword < ResponseError; end
|
227
|
+
|
228
|
+
class InvalidOperator < ResponseError; end
|
229
|
+
|
230
|
+
class InvalidOrNullForRestrictedPicklist < ResponseError; end
|
231
|
+
|
232
|
+
class InvalidQueryFilterOperator < ResponseError; end
|
233
|
+
|
234
|
+
class InvalidQueryLocator < ResponseError; end
|
235
|
+
|
236
|
+
class InvalidPartnerNetworkStatus < ResponseError; end
|
237
|
+
|
238
|
+
class InvalidPersonAccountOperation < ResponseError; end
|
239
|
+
|
240
|
+
class InvalidReadOnlyUserDml < ResponseError; end
|
241
|
+
|
242
|
+
class InvalidReplicationDate < ResponseError; end
|
243
|
+
|
244
|
+
class InvalidSaveAsActivityFlag < ResponseError; end
|
245
|
+
|
246
|
+
class InvalidSessionId < ResponseError; end
|
247
|
+
|
248
|
+
class InvalidSignupCountry < ResponseError; end
|
249
|
+
|
250
|
+
class InvalidStatus < ResponseError; end
|
251
|
+
|
252
|
+
class InvalidType < ResponseError; end
|
253
|
+
|
254
|
+
class InvalidTypeForOperation < ResponseError; end
|
255
|
+
|
256
|
+
class InvalidTypeOnFieldInRecord < ResponseError; end
|
257
|
+
|
258
|
+
class IpRangeLimitExceeded < ResponseError; end
|
259
|
+
|
260
|
+
class JigsawImportLimitExceeded < ResponseError; end
|
261
|
+
|
262
|
+
class JsonParserError < ResponseError; end
|
263
|
+
|
264
|
+
class LicenseLimitExceeded < ResponseError; end
|
265
|
+
|
266
|
+
class LightPortalUserException < ResponseError; end
|
267
|
+
|
268
|
+
class LimitExceeded < ResponseError; end
|
269
|
+
|
270
|
+
class LoginChallengeIssued < ResponseError; end
|
271
|
+
|
272
|
+
class LoginChallengePending < ResponseError; end
|
273
|
+
|
274
|
+
class LoginMustUseSecurityToken < ResponseError; end
|
275
|
+
|
276
|
+
class MalformedId < ResponseError; end
|
277
|
+
|
278
|
+
class MalformedQuery < ResponseError; end
|
279
|
+
|
280
|
+
class MalformedSearch < ResponseError; end
|
281
|
+
|
282
|
+
class ManagerNotDefined < ResponseError; end
|
283
|
+
|
284
|
+
class MassmailRetryLimitExceeded < ResponseError; end
|
285
|
+
|
286
|
+
class MassMailLimitExceeded < ResponseError; end
|
287
|
+
|
288
|
+
class MaximumCcemailsExceeded < ResponseError; end
|
289
|
+
|
290
|
+
class MaximumDashboardComponentsExceeded < ResponseError; end
|
291
|
+
|
292
|
+
class MaximumHierarchyLevelsReached < ResponseError; end
|
293
|
+
|
294
|
+
class MaximumSizeOfAttachment < ResponseError; end
|
295
|
+
|
296
|
+
class MaximumSizeOfDocument < ResponseError; end
|
297
|
+
|
298
|
+
class MaxActionsPerRuleExceeded < ResponseError; end
|
299
|
+
|
300
|
+
class MaxActiveRulesExceeded < ResponseError; end
|
301
|
+
|
302
|
+
class MaxApprovalStepsExceeded < ResponseError; end
|
303
|
+
|
304
|
+
class MaxFormulasPerRuleExceeded < ResponseError; end
|
305
|
+
|
306
|
+
class MaxRulesExceeded < ResponseError; end
|
307
|
+
|
308
|
+
class MaxRuleEntriesExceeded < ResponseError; end
|
309
|
+
|
310
|
+
class MaxTaskDescriptionExceeded < ResponseError; end
|
311
|
+
|
312
|
+
class MaxTmRulesExceeded < ResponseError; end
|
313
|
+
|
314
|
+
class MaxTmRuleItemsExceeded < ResponseError; end
|
315
|
+
|
316
|
+
class MergeFailed < ResponseError; end
|
317
|
+
|
318
|
+
class MethodNotAllowed < ResponseError; end
|
319
|
+
|
320
|
+
class MissingArgument < ResponseError; end
|
321
|
+
|
322
|
+
class NonuniqueShippingAddress < ResponseError; end
|
323
|
+
|
324
|
+
class NoApplicableProcess < ResponseError; end
|
325
|
+
|
326
|
+
class NoAttachmentPermission < ResponseError; end
|
327
|
+
|
328
|
+
class NoInactiveDivisionMembers < ResponseError; end
|
329
|
+
|
330
|
+
class NoMassMailPermission < ResponseError; end
|
331
|
+
|
332
|
+
class NumberOutsideValidRange < ResponseError; end
|
333
|
+
|
334
|
+
class NumHistoryFieldsBySobjectExceeded < ResponseError; end
|
335
|
+
|
336
|
+
class OpWithInvalidUserTypeException < ResponseError; end
|
337
|
+
|
338
|
+
class OperationTooLarge < ResponseError; end
|
339
|
+
|
340
|
+
class OptedOutOfMassMail < ResponseError; end
|
341
|
+
|
342
|
+
class PackageLicenseRequired < ResponseError; end
|
343
|
+
|
344
|
+
class PlatformEventEncryptionError < ResponseError; end
|
345
|
+
|
346
|
+
class PlatformEventPublishingUnavailable < ResponseError; end
|
347
|
+
|
348
|
+
class PlatformEventPublishFailed < ResponseError; end
|
349
|
+
|
350
|
+
class PortalUserAlreadyExistsForContact < ResponseError; end
|
351
|
+
|
352
|
+
class PrivateContactOnAsset < ResponseError; end
|
353
|
+
|
354
|
+
class QueryTimeout < ResponseError; end
|
355
|
+
|
356
|
+
class RecordInUseByWorkflow < ResponseError; end
|
357
|
+
|
358
|
+
class RequestLimitExceeded < ResponseError; end
|
359
|
+
|
360
|
+
class RequestRunningTooLong < ResponseError; end
|
361
|
+
|
362
|
+
class RequiredFieldMissing < ResponseError; end
|
363
|
+
|
364
|
+
class SelfReferenceFromTrigger < ResponseError; end
|
365
|
+
|
366
|
+
class ServerUnavailable < ResponseError; end
|
367
|
+
|
368
|
+
class ShareNeededForChildOwner < ResponseError; end
|
369
|
+
|
370
|
+
class SingleEmailLimitExceeded < ResponseError; end
|
371
|
+
|
372
|
+
class StandardPriceNotDefined < ResponseError; end
|
373
|
+
|
374
|
+
class StorageLimitExceeded < ResponseError; end
|
375
|
+
|
376
|
+
class StringTooLong < ResponseError; end
|
377
|
+
|
378
|
+
class TabsetLimitExceeded < ResponseError; end
|
379
|
+
|
380
|
+
class TemplateNotActive < ResponseError; end
|
381
|
+
|
382
|
+
class TerritoryRealignInProgress < ResponseError; end
|
383
|
+
|
384
|
+
class TextDataOutsideSupportedCharset < ResponseError; end
|
385
|
+
|
386
|
+
class TooManyApexRequests < ResponseError; end
|
387
|
+
|
388
|
+
class TooManyEnumValue < ResponseError; end
|
389
|
+
|
390
|
+
class TransferRequiresRead < ResponseError; end
|
391
|
+
|
392
|
+
class UnableToLockRow < ResponseError; end
|
393
|
+
|
394
|
+
class UnavailableRecordtypeException < ResponseError; end
|
395
|
+
|
396
|
+
class UndeleteFailed < ResponseError; end
|
397
|
+
|
398
|
+
class UnknownException < ResponseError; end
|
399
|
+
|
400
|
+
class UnspecifiedEmailAddress < ResponseError; end
|
401
|
+
|
402
|
+
class UnsupportedApexTriggerOperation < ResponseError; end
|
403
|
+
|
404
|
+
class UnverifiedSenderAddress < ResponseError; end
|
405
|
+
|
406
|
+
class WeblinkSizeLimitExceeded < ResponseError; end
|
407
|
+
|
408
|
+
class WeblinkUrlInvalid < ResponseError; end
|
409
|
+
|
410
|
+
class WrongControllerType < ResponseError; end
|
411
|
+
|
412
|
+
# Maps `errorCode`s returned from Salesforce to the exception class
|
413
|
+
# to be used for these errors
|
414
|
+
ERROR_EXCEPTION_CLASSES = {
|
415
|
+
"ALL_OR_NONE_OPERATION_ROLLED_BACK" => AllOrNoneOperationRolledBack,
|
416
|
+
"ALREADY_IN_PROCESS" => AlreadyInProcess,
|
417
|
+
"APEX_ERROR" => ApexError,
|
418
|
+
"API_CURRENTLY_DISABLED" => ApiCurrentlyDisabled,
|
419
|
+
"API_DISABLED_FOR_ORG" => ApiDisabledForOrg,
|
420
|
+
"ASSIGNEE_TYPE_REQUIRED" => AssigneeTypeRequired,
|
421
|
+
"BAD_CUSTOM_ENTITY_PARENT_DOMAIN" => BadCustomEntityParentDomain,
|
422
|
+
"BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED" =>
|
423
|
+
BccNotAllowedIfBccComplianceEnabled,
|
424
|
+
"BCC_SELF_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED" =>
|
425
|
+
BccSelfNotAllowedIfBccComplianceEnabled,
|
426
|
+
"BIG_OBJECT_UNSUPPORTED_OPERATION" => BigObjectUnsupportedOperation,
|
427
|
+
"CANNOT_CASCADE_PRODUCT_ACTIVE" => CannotCascadeProductActive,
|
428
|
+
"CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD" =>
|
429
|
+
CannotChangeFieldTypeOfApexReferencedField,
|
430
|
+
"CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE" => CannotCreateAnotherManagedPackage,
|
431
|
+
"CANNOT_DEACTIVATE_DIVISION" => CannotDeactivateDivision,
|
432
|
+
"CANNOT_DELETE_LAST_DATED_CONVERSION_RATE" =>
|
433
|
+
CannotDeleteLastDatedConversionRate,
|
434
|
+
"CANNOT_DELETE_MANAGED_OBJECT" => CannotDeleteManagedObject,
|
435
|
+
"CANNOT_DISABLE_LAST_ADMIN" => CannotDisableLastAdmin,
|
436
|
+
"CANNOT_ENABLE_IP_RESTRICT_REQUESTS" => CannotEnableIpRestrictRequests,
|
437
|
+
"CANNOT_EXECUTE_FLOW_TRIGGER" => CannotExecuteFlowTrigger,
|
438
|
+
"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" => CannotInsertUpdateActivateEntity,
|
439
|
+
"CANNOT_MODIFY_MANAGED_OBJECT" => CannotModifyManagedObject,
|
440
|
+
"CANNOT_RENAME_APEX_REFERENCED_FIELD" => CannotRenameApexReferencedField,
|
441
|
+
"CANNOT_RENAME_APEX_REFERENCED_OBJECT" => CannotRenameApexReferencedObject,
|
442
|
+
"CANNOT_REPARENT_RECORD" => CannotReparentRecord,
|
443
|
+
"CANNOT_RESOLVE_NAME" => CannotResolveName,
|
444
|
+
"CANNOT_UPDATE_CONVERTED_LEAD" => CannotUpdateConvertedLead,
|
445
|
+
"CANT_DISABLE_CORP_CURRENCY" => CantDisableCorpCurrency,
|
446
|
+
"CANT_UNSET_CORP_CURRENCY" => CantUnsetCorpCurrency,
|
447
|
+
"CHILD_SHARE_FAILS_PARENT" => ChildShareFailsParent,
|
448
|
+
"CIRCULAR_DEPENDENCY" => CircularDependency,
|
449
|
+
"COMMUNITY_NOT_ACCESSIBLE" => CommunityNotAccessible,
|
450
|
+
"CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED" => CustomClobFieldLimitExceeded,
|
451
|
+
"CUSTOM_ENTITY_OR_FIELD_LIMIT" => CustomEntityOrFieldLimit,
|
452
|
+
"CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED" => CustomFieldIndexLimitExceeded,
|
453
|
+
"CUSTOM_INDEX_EXISTS" => CustomIndexExists,
|
454
|
+
"CUSTOM_LINK_LIMIT_EXCEEDED" => CustomLinkLimitExceeded,
|
455
|
+
"CUSTOM_METADATA_LIMIT_EXCEEDED" => CustomMetadataLimitExceeded,
|
456
|
+
"CUSTOM_SETTINGS_LIMIT_EXCEEDED" => CustomSettingsLimitExceeded,
|
457
|
+
"CUSTOM_TAB_LIMIT_EXCEEDED" => CustomTabLimitExceeded,
|
458
|
+
"DELETE_FAILED" => DeleteFailed,
|
459
|
+
"DEPENDENCY_EXISTS" => DependencyExists,
|
460
|
+
"DUPLICATE_CASE_SOLUTION" => DuplicateCaseSolution,
|
461
|
+
"DUPLICATE_CUSTOM_ENTITY_DEFINITION" => DuplicateCustomEntityDefinition,
|
462
|
+
"DUPLICATE_CUSTOM_TAB_MOTIF" => DuplicateCustomTabMotif,
|
463
|
+
"DUPLICATE_DEVELOPER_NAME" => DuplicateDeveloperName,
|
464
|
+
"DUPLICATES_DETECTED" => DuplicatesDetected,
|
465
|
+
"DUPLICATE_EXTERNAL_ID" => DuplicateExternalId,
|
466
|
+
"DUPLICATE_MASTER_LABEL" => DuplicateMasterLabel,
|
467
|
+
"DUPLICATE_SENDER_DISPLAY_NAME" => DuplicateSenderDisplayName,
|
468
|
+
"DUPLICATE_USERNAME" => DuplicateUsername,
|
469
|
+
"DUPLICATE_VALUE" => DuplicateValue,
|
470
|
+
"EMAIL_ADDRESS_BOUNCED" => EmailAddressBounced,
|
471
|
+
"EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR" => EmailNotProcessedDueToPriorError,
|
472
|
+
"EMAIL_OPTED_OUT" => EmailOptedOut,
|
473
|
+
"EMAIL_TEMPLATE_FORMULA_ERROR" => EmailTemplateFormulaError,
|
474
|
+
"EMAIL_TEMPLATE_MERGEFIELD_ACCESS_ERROR" =>
|
475
|
+
EmailTemplateMergefieldAccessError,
|
476
|
+
"EMAIL_TEMPLATE_MERGEFIELD_ERROR" => EmailTemplateMergefieldError,
|
477
|
+
"EMAIL_TEMPLATE_MERGEFIELD_VALUE_ERROR" => EmailTemplateMergefieldValueError,
|
478
|
+
"EMAIL_TEMPLATE_PROCESSING_ERROR" => EmailTemplateProcessingError,
|
479
|
+
"EMPTY_SCONTROL_FILE_NAME" => EmptyScontrolFileName,
|
480
|
+
"ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE" =>
|
481
|
+
EntityFailedIflastmodifiedOnUpdate,
|
482
|
+
"ENTITY_IS_ARCHIVED" => EntityIsArchived,
|
483
|
+
"ENTITY_IS_DELETED" => EntityIsDeleted,
|
484
|
+
"ENTITY_IS_LOCKED" => EntityIsLocked,
|
485
|
+
"ENVIRONMENT_HUB_MEMBERSHIP_CONFLICT" => EnvironmentHubMembershipConflict,
|
486
|
+
"ERROR_IN_MAILER" => ErrorInMailer,
|
487
|
+
"EXCEEDED_MAX_SEMIJOIN_SUBSELECTS" => ExceededMaxSemijoinSubselects,
|
488
|
+
"FAILED_ACTIVATION" => FailedActivation,
|
489
|
+
"FIELD_CUSTOM_VALIDATION_EXCEPTION" => FieldCustomValidationException,
|
490
|
+
"FIELD_FILTER_VALIDATION_EXCEPTION" => FieldFilterValidationException,
|
491
|
+
"FIELD_INTEGRITY_EXCEPTION" => FieldIntegrityException,
|
492
|
+
"FILTERED_LOOKUP_LIMIT_EXCEEDED" => FilteredLookupLimitExceeded,
|
493
|
+
"FORBIDDEN" => Forbidden,
|
494
|
+
"HTML_FILE_UPLOAD_NOT_ALLOWED" => HtmlFileUploadNotAllowed,
|
495
|
+
"ILLEGAL_QUERY_PARAMETER_VALUE" => IllegalQueryParameterValue,
|
496
|
+
"IMAGE_TOO_LARGE" => ImageTooLarge,
|
497
|
+
"INACTIVE_OWNER_OR_USER" => InactiveOwnerOrUser,
|
498
|
+
"INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE" =>
|
499
|
+
InsertUpdateDeleteNotAllowedDuringMaintenance,
|
500
|
+
"INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" =>
|
501
|
+
InsufficientAccessOnCrossReferenceEntity,
|
502
|
+
"INSUFFICIENT_ACCESS_OR_READONLY" => InsufficientAccessOrReadonly,
|
503
|
+
"INVALID_ACCESS_LEVEL" => InvalidAccessLevel,
|
504
|
+
"INVALID_ARGUMENT_TYPE" => InvalidArgumentType,
|
505
|
+
"INVALID_ASSIGNEE_TYPE" => InvalidAssigneeType,
|
506
|
+
"INVALID_ASSIGNMENT_RULE" => InvalidAssignmentRule,
|
507
|
+
"INVALID_BATCH_OPERATION" => InvalidBatchOperation,
|
508
|
+
"INVALID_CONTENT_TYPE" => InvalidContentType,
|
509
|
+
"INVALID_CREDIT_CARD_INFO" => InvalidCreditCardInfo,
|
510
|
+
"INVALID_CROSS_REFERENCE_KEY" => InvalidCrossReferenceKey,
|
511
|
+
"INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD" => InvalidCrossReferenceTypeForField,
|
512
|
+
"INVALID_CURRENCY_CONV_RATE" => InvalidCurrencyConvRate,
|
513
|
+
"INVALID_CURRENCY_CORP_RATE" => InvalidCurrencyCorpRate,
|
514
|
+
"INVALID_CURRENCY_ISO" => InvalidCurrencyIso,
|
515
|
+
"INVALID_EMAIL_ADDRESS" => InvalidEmailAddress,
|
516
|
+
"INVALID_EMPTY_KEY_OWNER" => InvalidEmptyKeyOwner,
|
517
|
+
"INVALID_EVENT_SUBSCRIPTION" => InvalidEventSubscription,
|
518
|
+
"INVALID_FIELD" => InvalidField,
|
519
|
+
"INVALID_FIELD_FOR_INSERT_UPDATE" => InvalidFieldForInsertUpdate,
|
520
|
+
"INVALID_FIELD_WHEN_USING_TEMPLATE" => InvalidFieldWhenUsingTemplate,
|
521
|
+
"INVALID_FILTER_ACTION" => InvalidFilterAction,
|
522
|
+
"INVALID_ID_FIELD" => InvalidIdField,
|
523
|
+
"INVALID_INET_ADDRESS" => InvalidInetAddress,
|
524
|
+
"INVALID_LINEITEM_CLONE_STATE" => InvalidLineitemCloneState,
|
525
|
+
"INVALID_MASTER_OR_TRANSLATED_SOLUTION" => InvalidMasterOrTranslatedSolution,
|
526
|
+
"INVALID_MESSAGE_ID_REFERENCE" => InvalidMessageIdReference,
|
527
|
+
"INVALID_OPERATION" => InvalidOperation,
|
528
|
+
"INVALID_OPERATION_WITH_EXPIRED_PASSWORD" => InvalidOperationWithExpiredPassword,
|
529
|
+
"INVALID_OPERATOR" => InvalidOperator,
|
530
|
+
"INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST" =>
|
531
|
+
InvalidOrNullForRestrictedPicklist,
|
532
|
+
"INVALID_QUERY_FILTER_OPERATOR" => InvalidQueryFilterOperator,
|
533
|
+
"INVALID_QUERY_LOCATOR" => InvalidQueryLocator,
|
534
|
+
"INVALID_PARTNER_NETWORK_STATUS" => InvalidPartnerNetworkStatus,
|
535
|
+
"INVALID_PERSON_ACCOUNT_OPERATION" => InvalidPersonAccountOperation,
|
536
|
+
"INVALID_READ_ONLY_USER_DML" => InvalidReadOnlyUserDml,
|
537
|
+
"INVALID_REPLICATION_DATE" => InvalidReplicationDate,
|
538
|
+
"INVALID_SAVE_AS_ACTIVITY_FLAG" => InvalidSaveAsActivityFlag,
|
539
|
+
"INVALID_SESSION_ID" => InvalidSessionId,
|
540
|
+
"INVALID_SIGNUP_COUNTRY" => InvalidSignupCountry,
|
541
|
+
"INVALID_STATUS" => InvalidStatus,
|
542
|
+
"INVALID_TYPE" => InvalidType,
|
543
|
+
"INVALID_TYPE_FOR_OPERATION" => InvalidTypeForOperation,
|
544
|
+
"INVALID_TYPE_ON_FIELD_IN_RECORD" => InvalidTypeOnFieldInRecord,
|
545
|
+
"IP_RANGE_LIMIT_EXCEEDED" => IpRangeLimitExceeded,
|
546
|
+
"JIGSAW_IMPORT_LIMIT_EXCEEDED" => JigsawImportLimitExceeded,
|
547
|
+
"JSON_PARSER_ERROR" => JsonParserError,
|
548
|
+
"LICENSE_LIMIT_EXCEEDED" => LicenseLimitExceeded,
|
549
|
+
"LIGHT_PORTAL_USER_EXCEPTION" => LightPortalUserException,
|
550
|
+
"LIMIT_EXCEEDED" => LimitExceeded,
|
551
|
+
"LOGIN_CHALLENGE_ISSUED" => LoginChallengeIssued,
|
552
|
+
"LOGIN_CHALLENGE_PENDING" => LoginChallengePending,
|
553
|
+
"LOGIN_MUST_USE_SECURITY_TOKEN" => LoginMustUseSecurityToken,
|
554
|
+
"MALFORMED_ID" => MalformedId,
|
555
|
+
"MALFORMED_QUERY" => MalformedQuery,
|
556
|
+
"MALFORMED_SEARCH" => MalformedSearch,
|
557
|
+
"MANAGER_NOT_DEFINED" => ManagerNotDefined,
|
558
|
+
"MASSMAIL_RETRY_LIMIT_EXCEEDED" => MassmailRetryLimitExceeded,
|
559
|
+
"MASS_MAIL_LIMIT_EXCEEDED" => MassMailLimitExceeded,
|
560
|
+
"MAXIMUM_CCEMAILS_EXCEEDED" => MaximumCcemailsExceeded,
|
561
|
+
"MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED" => MaximumDashboardComponentsExceeded,
|
562
|
+
"MAXIMUM_HIERARCHY_LEVELS_REACHED" => MaximumHierarchyLevelsReached,
|
563
|
+
"MAXIMUM_SIZE_OF_ATTACHMENT" => MaximumSizeOfAttachment,
|
564
|
+
"MAXIMUM_SIZE_OF_DOCUMENT" => MaximumSizeOfDocument,
|
565
|
+
"MAX_ACTIONS_PER_RULE_EXCEEDED" => MaxActionsPerRuleExceeded,
|
566
|
+
"MAX_ACTIVE_RULES_EXCEEDED" => MaxActiveRulesExceeded,
|
567
|
+
"MAX_APPROVAL_STEPS_EXCEEDED" => MaxApprovalStepsExceeded,
|
568
|
+
"MAX_FORMULAS_PER_RULE_EXCEEDED" => MaxFormulasPerRuleExceeded,
|
569
|
+
"MAX_RULES_EXCEEDED" => MaxRulesExceeded,
|
570
|
+
"MAX_RULE_ENTRIES_EXCEEDED" => MaxRuleEntriesExceeded,
|
571
|
+
"MAX_TASK_DESCRIPTION_EXCEEDED" => MaxTaskDescriptionExceeded,
|
572
|
+
"MAX_TM_RULES_EXCEEDED" => MaxTmRulesExceeded,
|
573
|
+
"MAX_TM_RULE_ITEMS_EXCEEDED" => MaxTmRuleItemsExceeded,
|
574
|
+
"MERGE_FAILED" => MergeFailed,
|
575
|
+
"METHOD_NOT_ALLOWED" => MethodNotAllowed,
|
576
|
+
"MISSING_ARGUMENT" => MissingArgument,
|
577
|
+
"NONUNIQUE_SHIPPING_ADDRESS" => NonuniqueShippingAddress,
|
578
|
+
"NO_APPLICABLE_PROCESS" => NoApplicableProcess,
|
579
|
+
"NO_ATTACHMENT_PERMISSION" => NoAttachmentPermission,
|
580
|
+
"NO_INACTIVE_DIVISION_MEMBERS" => NoInactiveDivisionMembers,
|
581
|
+
"NO_MASS_MAIL_PERMISSION" => NoMassMailPermission,
|
582
|
+
"NUMBER_OUTSIDE_VALID_RANGE" => NumberOutsideValidRange,
|
583
|
+
"NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED" => NumHistoryFieldsBySobjectExceeded,
|
584
|
+
"OP_WITH_INVALID_USER_TYPE_EXCEPTION" => OpWithInvalidUserTypeException,
|
585
|
+
"OPERATION_TOO_LARGE" => OperationTooLarge,
|
586
|
+
"OPTED_OUT_OF_MASS_MAIL" => OptedOutOfMassMail,
|
587
|
+
"PACKAGE_LICENSE_REQUIRED" => PackageLicenseRequired,
|
588
|
+
"PLATFORM_EVENT_ENCRYPTION_ERROR" => PlatformEventEncryptionError,
|
589
|
+
"PLATFORM_EVENT_PUBLISHING_UNAVAILABLE" => PlatformEventPublishingUnavailable,
|
590
|
+
"PLATFORM_EVENT_PUBLISH_FAILED" => PlatformEventPublishFailed,
|
591
|
+
"PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT" => PortalUserAlreadyExistsForContact,
|
592
|
+
"PRIVATE_CONTACT_ON_ASSET" => PrivateContactOnAsset,
|
593
|
+
"QUERY_TIMEOUT" => QueryTimeout,
|
594
|
+
"RECORD_IN_USE_BY_WORKFLOW" => RecordInUseByWorkflow,
|
595
|
+
"REQUEST_LIMIT_EXCEEDED" => RequestLimitExceeded,
|
596
|
+
"REQUEST_RUNNING_TOO_LONG" => RequestRunningTooLong,
|
597
|
+
"REQUIRED_FIELD_MISSING" => RequiredFieldMissing,
|
598
|
+
"SELF_REFERENCE_FROM_TRIGGER" => SelfReferenceFromTrigger,
|
599
|
+
"SERVER_UNAVAILABLE" => ServerUnavailable,
|
600
|
+
"SHARE_NEEDED_FOR_CHILD_OWNER" => ShareNeededForChildOwner,
|
601
|
+
"SINGLE_EMAIL_LIMIT_EXCEEDED" => SingleEmailLimitExceeded,
|
602
|
+
"STANDARD_PRICE_NOT_DEFINED" => StandardPriceNotDefined,
|
603
|
+
"STORAGE_LIMIT_EXCEEDED" => StorageLimitExceeded,
|
604
|
+
"STRING_TOO_LONG" => StringTooLong,
|
605
|
+
"TABSET_LIMIT_EXCEEDED" => TabsetLimitExceeded,
|
606
|
+
"TEMPLATE_NOT_ACTIVE" => TemplateNotActive,
|
607
|
+
"TERRITORY_REALIGN_IN_PROGRESS" => TerritoryRealignInProgress,
|
608
|
+
"TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET" => TextDataOutsideSupportedCharset,
|
609
|
+
"TOO_MANY_APEX_REQUESTS" => TooManyApexRequests,
|
610
|
+
"TOO_MANY_ENUM_VALUE" => TooManyEnumValue,
|
611
|
+
"TRANSFER_REQUIRES_READ" => TransferRequiresRead,
|
612
|
+
"UNABLE_TO_LOCK_ROW" => UnableToLockRow,
|
613
|
+
"UNAVAILABLE_RECORDTYPE_EXCEPTION" => UnavailableRecordtypeException,
|
614
|
+
"UNDELETE_FAILED" => UndeleteFailed,
|
615
|
+
"UNKNOWN_EXCEPTION" => UnknownException,
|
616
|
+
"UNSPECIFIED_EMAIL_ADDRESS" => UnspecifiedEmailAddress,
|
617
|
+
"UNSUPPORTED_APEX_TRIGGER_OPERATION" => UnsupportedApexTriggerOperation,
|
618
|
+
"UNVERIFIED_SENDER_ADDRESS" => UnverifiedSenderAddress,
|
619
|
+
"WEBLINK_SIZE_LIMIT_EXCEEDED" => WeblinkSizeLimitExceeded,
|
620
|
+
"WEBLINK_URL_INVALID" => WeblinkUrlInvalid,
|
621
|
+
"WRONG_CONTROLLER_TYPE" => WrongControllerType
|
622
|
+
}.freeze
|
623
|
+
|
624
|
+
def self.get_exception_class(error_code)
|
625
|
+
ERROR_EXCEPTION_CLASSES.fetch(error_code) do |_|
|
626
|
+
warn "[restforce] An unrecognised error code, `#{error_code}` has been " \
|
627
|
+
"received from Salesforce. Instead of raising an error-specific exception" \
|
628
|
+
", we'll raise a generic `ResponseError`. Please report this missing " \
|
629
|
+
"error code on GitHub at <#{GITHUB_ISSUE_URL}>."
|
630
|
+
|
631
|
+
# If we've received an unexpected error where we don't have a specific
|
632
|
+
# class defined, we can return a generic ResponseError instead
|
633
|
+
ResponseError
|
634
|
+
end
|
635
|
+
end
|
636
|
+
|
637
|
+
def self.const_missing(constant_name)
|
638
|
+
warn "[restforce] You're referring to a Restforce error that isn't defined, " \
|
639
|
+
"`#{name}::#{constant_name}` (for example by trying to `rescue` it). This " \
|
640
|
+
"might be our fault - we've recently made some changes to how errors are " \
|
641
|
+
"defined. If you're sure that this is a valid Salesforce error, then " \
|
642
|
+
"please create an issue on GitHub at <#{GITHUB_ISSUE_URL}>."
|
643
|
+
|
644
|
+
super(constant_name)
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'faraday/file_part'
|
5
|
+
rescue LoadError
|
6
|
+
require 'faraday/upload_io'
|
7
|
+
end
|
8
|
+
|
9
|
+
module Restforce
|
10
|
+
if defined?(::Faraday::FilePart)
|
11
|
+
FilePart = Faraday::FilePart
|
12
|
+
|
13
|
+
# Deprecated
|
14
|
+
UploadIO = Faraday::FilePart
|
15
|
+
else
|
16
|
+
# Handle pre-1.0 versions of faraday
|
17
|
+
FilePart = Faraday::UploadIO
|
18
|
+
UploadIO = Faraday::UploadIO
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# This patch is only needed with multipart-post < 2.0.0
|
23
|
+
# 2.0.0 was released in 2013.
|
24
|
+
require 'restforce/patches/parts' unless Parts::Part.method(:new).arity.abs == 4
|