restforce 5.0.3 → 5.1.0
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 +9 -9
- data/.github/dependabot.yml +19 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +26 -0
- data/Gemfile +10 -6
- data/README.md +6 -5
- data/lib/restforce/concerns/api.rb +1 -1
- data/lib/restforce/concerns/base.rb +2 -2
- data/lib/restforce/concerns/streaming.rb +1 -3
- data/lib/restforce/error_code.rb +223 -9
- data/lib/restforce/middleware/logger.rb +5 -5
- data/lib/restforce/version.rb +1 -1
- data/restforce.gemspec +2 -11
- data/spec/integration/abstract_client_spec.rb +25 -28
- data/spec/integration/data/client_spec.rb +6 -2
- data/spec/spec_helper.rb +10 -0
- data/spec/support/client_integration.rb +7 -7
- data/spec/support/concerns.rb +1 -1
- data/spec/support/middleware.rb +1 -2
- data/spec/unit/collection_spec.rb +4 -4
- data/spec/unit/concerns/api_spec.rb +11 -11
- data/spec/unit/concerns/authentication_spec.rb +6 -6
- data/spec/unit/concerns/streaming_spec.rb +3 -3
- data/spec/unit/config_spec.rb +1 -1
- 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 +4 -0
- data/spec/unit/middleware/gzip_spec.rb +2 -2
- data/spec/unit/middleware/raise_error_spec.rb +20 -10
- metadata +12 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b1e2a0404ca613dba1e5bf8dd0cac2672e8ae05a939693c9b06451379bc3f4
|
4
|
+
data.tar.gz: 93fc9d6f07255f56a0bc6b93fc89402f0b6f8b5b4c616f8924e02cb791d21c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24394432042f990f2ef634a7721917fae4bc671c7b9c1a44c16e5bfc11811262ff1489418e769cb5177baacf8ad30e1f0c3fa3506b2e817c3465b324f78fd719
|
7
|
+
data.tar.gz: 5f12f8479aaab44b75a4e0c93832ed245767d5acc659f2a7d854116423e3701aa8e2203cd3ef5018e5894c504b037dee30132a4f0c09cd8b410165c6e612ebc8
|
data/.circleci/config.yml
CHANGED
@@ -34,23 +34,23 @@ references:
|
|
34
34
|
destination: test-results
|
35
35
|
|
36
36
|
jobs:
|
37
|
-
build-
|
37
|
+
build-ruby30:
|
38
38
|
docker:
|
39
|
-
- image: circleci/ruby:
|
39
|
+
- image: circleci/ruby:3.0
|
40
40
|
steps: *steps
|
41
|
-
build-
|
41
|
+
build-ruby27:
|
42
42
|
docker:
|
43
|
-
- image: circleci/ruby:2.
|
43
|
+
- image: circleci/ruby:2.7
|
44
44
|
steps: *steps
|
45
|
-
build-
|
45
|
+
build-ruby26:
|
46
46
|
docker:
|
47
|
-
- image: circleci/ruby:2.
|
47
|
+
- image: circleci/ruby:2.6
|
48
48
|
steps: *steps
|
49
49
|
|
50
50
|
workflows:
|
51
51
|
version: 2
|
52
52
|
tests:
|
53
53
|
jobs:
|
54
|
-
- build-
|
55
|
-
- build-
|
56
|
-
- build-
|
54
|
+
- build-ruby30
|
55
|
+
- build-ruby27
|
56
|
+
- build-ruby26
|
@@ -0,0 +1,19 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
open-pull-requests-limit: 10
|
8
|
+
ignore:
|
9
|
+
- dependency-name: rubocop
|
10
|
+
versions:
|
11
|
+
- 1.10.0
|
12
|
+
- 1.11.0
|
13
|
+
- 1.12.0
|
14
|
+
- 1.12.1
|
15
|
+
- 1.9.0
|
16
|
+
- dependency-name: webmock
|
17
|
+
versions:
|
18
|
+
- 3.12.0
|
19
|
+
- 3.12.1
|
data/.rubocop.yml
CHANGED
@@ -8,7 +8,7 @@ AllCops:
|
|
8
8
|
- .*/**/*
|
9
9
|
- vendor/**/*
|
10
10
|
NewCops: enable
|
11
|
-
TargetRubyVersion: 2.
|
11
|
+
TargetRubyVersion: 2.6
|
12
12
|
|
13
13
|
# Limit lines to 90 characters.
|
14
14
|
Layout/LineLength:
|
@@ -71,4 +71,4 @@ Naming/FileName:
|
|
71
71
|
- Guardfile
|
72
72
|
|
73
73
|
Lint/UriEscapeUnescape:
|
74
|
-
Enabled: false
|
74
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## 5.1.0 (Aug 26, 2021)
|
2
|
+
|
3
|
+
* Add official support for Ruby 3.0 (@timrogers)
|
4
|
+
* Drop support for Ruby 2.5, which has reached end-of-life (@timrogers)
|
5
|
+
* Handle the `QUERY_TIMEOUT` error returned by Salesforce (@timrogers)
|
6
|
+
* Remove unnecessary development dependencies for the gem, which can just be in the project's `Gemfile` (@timrogers)
|
7
|
+
|
8
|
+
## 5.0.6 (Jun 17, 2021)
|
9
|
+
|
10
|
+
* Handle the `API_DISABLED_FOR_ORG` error returned by Salesforce (@cmac)
|
11
|
+
* Handle the `METHOD_NOT_ALLOWED` error returned by Salesforce (@timrogers)
|
12
|
+
* Handle the `APEX_ERROR` error returned by Salesforce (@timrogers)
|
13
|
+
|
14
|
+
## 5.0.5 (Feb 17, 2021)
|
15
|
+
|
16
|
+
* Handle the `CANNOT_EXECUTE_FLOW_TRIGGER` error returned by Salesforce (@almusavi, @timrogers)
|
17
|
+
|
18
|
+
## 5.0.4 (Jan 18, 2021)
|
19
|
+
|
20
|
+
* Handle the `INVALID_QUERY_LOCATOR` error returned by Salesforce
|
21
|
+
* Handle the `INVALID_OPERATION_WITH_EXPIRED_PASSWORD` error returned by Salesforce
|
22
|
+
* Handle the `FIELD_INTEGRITY_EXCEPTION` error returned by Salesforce
|
23
|
+
* Handle the `FORBIDDEN` error returned by Salesforce
|
24
|
+
* Handle the `ILLEGAL_QUERY_PARAMETER_VALUE` error returned by Salesforce
|
25
|
+
* Handle the `JSON_PARSER_ERROR` error returned by Salesforce
|
26
|
+
|
1
27
|
## 5.0.3 (Sep 8, 2020)
|
2
28
|
|
3
29
|
* Handle the undocumented `EXCEEDED_MAX_SEMIJOIN_SUBSELECTS` error returned by Salesforce (@embertel, @timrogers)
|
data/Gemfile
CHANGED
@@ -3,11 +3,15 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
gem 'faye' unless RUBY_PLATFORM == 'java'
|
7
|
+
gem 'guard-rspec'
|
8
|
+
gem 'guard-rubocop'
|
6
9
|
gem 'jruby-openssl', platforms: :jruby
|
7
|
-
gem 'jwt'
|
8
10
|
gem 'rake'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
gem 'rspec', '~> 3.10.0'
|
12
|
+
gem 'rspec-collection_matchers', '~> 1.2.0'
|
13
|
+
gem 'rspec-its', '~> 1.3.0'
|
14
|
+
gem 'rspec_junit_formatter', '~> 0.4.1'
|
15
|
+
gem 'rubocop', '~> 1.20.0'
|
16
|
+
gem 'simplecov', '~> 0.21.2'
|
17
|
+
gem 'webmock', '~> 3.14.0'
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ Features include:
|
|
25
25
|
|
26
26
|
Add this line to your application's Gemfile:
|
27
27
|
|
28
|
-
gem 'restforce', '~> 5.0
|
28
|
+
gem 'restforce', '~> 5.1.0'
|
29
29
|
|
30
30
|
And then execute:
|
31
31
|
|
@@ -35,9 +35,10 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
$ gem install restforce
|
37
37
|
|
38
|
-
__As of version 5.0.0, this gem is only compatible with Ruby 2.
|
38
|
+
__As of version 5.0.0, this gem is only compatible with Ruby 2.6.0 and later.__ If you're using an earlier Ruby version:
|
39
39
|
|
40
|
-
* for Ruby 2.
|
40
|
+
* for Ruby 2.5, use version 5.0.6 or earlier
|
41
|
+
* for Ruby 2.4, use version 4.3.0 or earlier
|
41
42
|
* for Ruby 2.3, use version 3.2.0 or earlier
|
42
43
|
* for Ruby versions 2.2, 2.1 and 2.0, use version 2.5.3 or earlier
|
43
44
|
* for Ruby 1.9.3, use version 2.4.2
|
@@ -459,7 +460,7 @@ info.user_id
|
|
459
460
|
|
460
461
|
### File Uploads
|
461
462
|
|
462
|
-
Using the new [Blob Data](
|
463
|
+
Using the new [Blob Data](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm) api feature (500mb limit):
|
463
464
|
|
464
465
|
```ruby
|
465
466
|
client.create('Document', FolderId: '00lE0000000FJ6H',
|
@@ -477,7 +478,7 @@ client.create('Document', FolderId: '00lE0000000FJ6H',
|
|
477
478
|
Body: Base64::encode64(File.read('image.jpg'))
|
478
479
|
```
|
479
480
|
|
480
|
-
_See also: [Inserting or updating blob data](
|
481
|
+
_See also: [Inserting or updating blob data](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)_
|
481
482
|
|
482
483
|
* * *
|
483
484
|
|
@@ -380,7 +380,7 @@ module Restforce
|
|
380
380
|
end
|
381
381
|
else
|
382
382
|
api_patch "sobjects/#{sobject}/#{field}/" \
|
383
|
-
|
383
|
+
"#{ERB::Util.url_encode(external_id)}", attrs
|
384
384
|
end
|
385
385
|
|
386
386
|
response.body.respond_to?(:fetch) ? response.body.fetch('id', true) : true
|
@@ -61,9 +61,9 @@ module Restforce
|
|
61
61
|
def initialize(opts = {})
|
62
62
|
raise ArgumentError, 'Please specify a hash of options' unless opts.is_a?(Hash)
|
63
63
|
|
64
|
-
@options =
|
64
|
+
@options = Restforce.configuration.options.map do |option|
|
65
65
|
[option, Restforce.configuration.send(option)]
|
66
|
-
end
|
66
|
+
end.to_h
|
67
67
|
|
68
68
|
@options.merge! opts
|
69
69
|
yield builder if block_given?
|
@@ -95,9 +95,7 @@ module Restforce
|
|
95
95
|
|
96
96
|
def replay_id(channel)
|
97
97
|
handler = @replay_handlers[channel]
|
98
|
-
if handler.is_a?(Integer)
|
99
|
-
handler # treat it as a scalar
|
100
|
-
elsif handler.respond_to?(:[])
|
98
|
+
if handler.respond_to?(:[]) && !handler.is_a?(Integer)
|
101
99
|
# Ask for the latest replayId for this channel
|
102
100
|
handler[channel]
|
103
101
|
else
|
data/lib/restforce/error_code.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module Restforce
|
4
4
|
module ErrorCode
|
5
5
|
GITHUB_ISSUE_URL = "https://github.com/restforce/restforce/issues/new?template=" \
|
6
|
-
|
7
|
-
|
6
|
+
"unhandled-salesforce-error.md&title=Unhandled+Salesforce+error" \
|
7
|
+
"%3A+%3Cinsert+error+code+here%3E"
|
8
8
|
|
9
9
|
# We define all of the known errors returned by Salesforce based on the
|
10
10
|
# documentation at
|
@@ -14,186 +14,389 @@ module Restforce
|
|
14
14
|
# It is possible that we will be missing some errors, so we will handle this in
|
15
15
|
# at least a semi-graceful manner.
|
16
16
|
class AllOrNoneOperationRolledBack < ResponseError; end
|
17
|
+
|
17
18
|
class AlreadyInProcess < ResponseError; end
|
19
|
+
|
20
|
+
class ApexError < ResponseError; end
|
21
|
+
|
18
22
|
class ApiCurrentlyDisabled < ResponseError; end
|
23
|
+
|
24
|
+
class ApiDisabledForOrg < ResponseError; end
|
25
|
+
|
19
26
|
class AssigneeTypeRequired < ResponseError; end
|
27
|
+
|
20
28
|
class BadCustomEntityParentDomain < ResponseError; end
|
29
|
+
|
21
30
|
class BccNotAllowedIfBccComplianceEnabled < ResponseError; end
|
31
|
+
|
22
32
|
class BccSelfNotAllowedIfBccComplianceEnabled < ResponseError; end
|
33
|
+
|
23
34
|
class CannotCascadeProductActive < ResponseError; end
|
35
|
+
|
24
36
|
class CannotChangeFieldTypeOfApexReferencedField < ResponseError; end
|
37
|
+
|
25
38
|
class CannotCreateAnotherManagedPackage < ResponseError; end
|
39
|
+
|
26
40
|
class CannotDeactivateDivision < ResponseError; end
|
41
|
+
|
27
42
|
class CannotDeleteLastDatedConversionRate < ResponseError; end
|
43
|
+
|
28
44
|
class CannotDeleteManagedObject < ResponseError; end
|
45
|
+
|
29
46
|
class CannotDisableLastAdmin < ResponseError; end
|
47
|
+
|
30
48
|
class CannotEnableIpRestrictRequests < ResponseError; end
|
49
|
+
|
50
|
+
class CannotExecuteFlowTrigger < ResponseError; end
|
51
|
+
|
31
52
|
class CannotInsertUpdateActivateEntity < ResponseError; end
|
53
|
+
|
32
54
|
class CannotModifyManagedObject < ResponseError; end
|
55
|
+
|
33
56
|
class CannotRenameApexReferencedField < ResponseError; end
|
57
|
+
|
34
58
|
class CannotRenameApexReferencedObject < ResponseError; end
|
59
|
+
|
35
60
|
class CannotReparentRecord < ResponseError; end
|
61
|
+
|
36
62
|
class CannotResolveName < ResponseError; end
|
63
|
+
|
37
64
|
class CannotUpdateConvertedLead < ResponseError; end
|
65
|
+
|
38
66
|
class CantDisableCorpCurrency < ResponseError; end
|
67
|
+
|
39
68
|
class CantUnsetCorpCurrency < ResponseError; end
|
69
|
+
|
40
70
|
class ChildShareFailsParent < ResponseError; end
|
71
|
+
|
41
72
|
class CircularDependency < ResponseError; end
|
73
|
+
|
42
74
|
class CommunityNotAccessible < ResponseError; end
|
75
|
+
|
43
76
|
class CustomClobFieldLimitExceeded < ResponseError; end
|
77
|
+
|
44
78
|
class CustomEntityOrFieldLimit < ResponseError; end
|
79
|
+
|
45
80
|
class CustomFieldIndexLimitExceeded < ResponseError; end
|
81
|
+
|
46
82
|
class CustomIndexExists < ResponseError; end
|
83
|
+
|
47
84
|
class CustomLinkLimitExceeded < ResponseError; end
|
85
|
+
|
48
86
|
class CustomMetadataLimitExceeded < ResponseError; end
|
87
|
+
|
49
88
|
class CustomSettingsLimitExceeded < ResponseError; end
|
89
|
+
|
50
90
|
class CustomTabLimitExceeded < ResponseError; end
|
91
|
+
|
51
92
|
class DeleteFailed < ResponseError; end
|
93
|
+
|
52
94
|
class DependencyExists < ResponseError; end
|
95
|
+
|
53
96
|
class DuplicateCaseSolution < ResponseError; end
|
97
|
+
|
54
98
|
class DuplicateCustomEntityDefinition < ResponseError; end
|
99
|
+
|
55
100
|
class DuplicateCustomTabMotif < ResponseError; end
|
101
|
+
|
56
102
|
class DuplicateDeveloperName < ResponseError; end
|
103
|
+
|
57
104
|
class DuplicatesDetected < ResponseError; end
|
105
|
+
|
58
106
|
class DuplicateExternalId < ResponseError; end
|
107
|
+
|
59
108
|
class DuplicateMasterLabel < ResponseError; end
|
109
|
+
|
60
110
|
class DuplicateSenderDisplayName < ResponseError; end
|
111
|
+
|
61
112
|
class DuplicateUsername < ResponseError; end
|
113
|
+
|
62
114
|
class DuplicateValue < ResponseError; end
|
115
|
+
|
63
116
|
class EmailAddressBounced < ResponseError; end
|
117
|
+
|
64
118
|
class EmailNotProcessedDueToPriorError < ResponseError; end
|
119
|
+
|
65
120
|
class EmailOptedOut < ResponseError; end
|
121
|
+
|
66
122
|
class EmailTemplateFormulaError < ResponseError; end
|
123
|
+
|
67
124
|
class EmailTemplateMergefieldAccessError < ResponseError; end
|
125
|
+
|
68
126
|
class EmailTemplateMergefieldError < ResponseError; end
|
127
|
+
|
69
128
|
class EmailTemplateMergefieldValueError < ResponseError; end
|
129
|
+
|
70
130
|
class EmailTemplateProcessingError < ResponseError; end
|
131
|
+
|
71
132
|
class EmptyScontrolFileName < ResponseError; end
|
133
|
+
|
72
134
|
class EntityFailedIflastmodifiedOnUpdate < ResponseError; end
|
135
|
+
|
73
136
|
class EntityIsArchived < ResponseError; end
|
137
|
+
|
74
138
|
class EntityIsDeleted < ResponseError; end
|
139
|
+
|
75
140
|
class EntityIsLocked < ResponseError; end
|
141
|
+
|
76
142
|
class EnvironmentHubMembershipConflict < ResponseError; end
|
143
|
+
|
77
144
|
class ErrorInMailer < ResponseError; end
|
145
|
+
|
78
146
|
class ExceededMaxSemijoinSubselects < ResponseError; end
|
147
|
+
|
79
148
|
class FailedActivation < ResponseError; end
|
149
|
+
|
80
150
|
class FieldCustomValidationException < ResponseError; end
|
151
|
+
|
81
152
|
class FieldFilterValidationException < ResponseError; end
|
153
|
+
|
154
|
+
class FieldIntegrityException < ResponseError; end
|
155
|
+
|
82
156
|
class FilteredLookupLimitExceeded < ResponseError; end
|
157
|
+
|
158
|
+
class Forbidden < ResponseError; end
|
159
|
+
|
83
160
|
class HtmlFileUploadNotAllowed < ResponseError; end
|
161
|
+
|
162
|
+
class IllegalQueryParameterValue < ResponseError; end
|
163
|
+
|
84
164
|
class ImageTooLarge < ResponseError; end
|
165
|
+
|
85
166
|
class InactiveOwnerOrUser < ResponseError; end
|
167
|
+
|
86
168
|
class InsertUpdateDeleteNotAllowedDuringMaintenance < ResponseError; end
|
169
|
+
|
87
170
|
class InsufficientAccessOnCrossReferenceEntity < ResponseError; end
|
171
|
+
|
88
172
|
class InsufficientAccessOrReadonly < ResponseError; end
|
173
|
+
|
89
174
|
class InvalidAccessLevel < ResponseError; end
|
175
|
+
|
90
176
|
class InvalidArgumentType < ResponseError; end
|
177
|
+
|
91
178
|
class InvalidAssigneeType < ResponseError; end
|
179
|
+
|
92
180
|
class InvalidAssignmentRule < ResponseError; end
|
181
|
+
|
93
182
|
class InvalidBatchOperation < ResponseError; end
|
183
|
+
|
94
184
|
class InvalidContentType < ResponseError; end
|
185
|
+
|
95
186
|
class InvalidCreditCardInfo < ResponseError; end
|
187
|
+
|
96
188
|
class InvalidCrossReferenceKey < ResponseError; end
|
189
|
+
|
97
190
|
class InvalidCrossReferenceTypeForField < ResponseError; end
|
191
|
+
|
98
192
|
class InvalidCurrencyConvRate < ResponseError; end
|
193
|
+
|
99
194
|
class InvalidCurrencyCorpRate < ResponseError; end
|
195
|
+
|
100
196
|
class InvalidCurrencyIso < ResponseError; end
|
197
|
+
|
101
198
|
class InvalidEmailAddress < ResponseError; end
|
199
|
+
|
102
200
|
class InvalidEmptyKeyOwner < ResponseError; end
|
201
|
+
|
103
202
|
class InvalidEventSubscription < ResponseError; end
|
203
|
+
|
104
204
|
class InvalidField < ResponseError; end
|
205
|
+
|
105
206
|
class InvalidFieldForInsertUpdate < ResponseError; end
|
207
|
+
|
106
208
|
class InvalidFieldWhenUsingTemplate < ResponseError; end
|
209
|
+
|
107
210
|
class InvalidFilterAction < ResponseError; end
|
211
|
+
|
108
212
|
class InvalidIdField < ResponseError; end
|
213
|
+
|
109
214
|
class InvalidInetAddress < ResponseError; end
|
215
|
+
|
110
216
|
class InvalidLineitemCloneState < ResponseError; end
|
217
|
+
|
111
218
|
class InvalidMasterOrTranslatedSolution < ResponseError; end
|
219
|
+
|
112
220
|
class InvalidMessageIdReference < ResponseError; end
|
221
|
+
|
113
222
|
class InvalidOperation < ResponseError; end
|
223
|
+
|
224
|
+
class InvalidOperationWithExpiredPassword < ResponseError; end
|
225
|
+
|
114
226
|
class InvalidOperator < ResponseError; end
|
227
|
+
|
115
228
|
class InvalidOrNullForRestrictedPicklist < ResponseError; end
|
229
|
+
|
116
230
|
class InvalidQueryFilterOperator < ResponseError; end
|
231
|
+
|
232
|
+
class InvalidQueryLocator < ResponseError; end
|
233
|
+
|
117
234
|
class InvalidPartnerNetworkStatus < ResponseError; end
|
235
|
+
|
118
236
|
class InvalidPersonAccountOperation < ResponseError; end
|
237
|
+
|
119
238
|
class InvalidReadOnlyUserDml < ResponseError; end
|
239
|
+
|
120
240
|
class InvalidSaveAsActivityFlag < ResponseError; end
|
241
|
+
|
121
242
|
class InvalidSessionId < ResponseError; end
|
243
|
+
|
122
244
|
class InvalidStatus < ResponseError; end
|
245
|
+
|
123
246
|
class InvalidType < ResponseError; end
|
247
|
+
|
124
248
|
class InvalidTypeForOperation < ResponseError; end
|
249
|
+
|
125
250
|
class InvalidTypeOnFieldInRecord < ResponseError; end
|
251
|
+
|
126
252
|
class IpRangeLimitExceeded < ResponseError; end
|
253
|
+
|
127
254
|
class JigsawImportLimitExceeded < ResponseError; end
|
255
|
+
|
256
|
+
class JsonParserError < ResponseError; end
|
257
|
+
|
128
258
|
class LicenseLimitExceeded < ResponseError; end
|
259
|
+
|
129
260
|
class LightPortalUserException < ResponseError; end
|
261
|
+
|
130
262
|
class LimitExceeded < ResponseError; end
|
263
|
+
|
131
264
|
class LoginChallengeIssued < ResponseError; end
|
265
|
+
|
132
266
|
class LoginChallengePending < ResponseError; end
|
267
|
+
|
133
268
|
class LoginMustUseSecurityToken < ResponseError; end
|
269
|
+
|
134
270
|
class MalformedId < ResponseError; end
|
271
|
+
|
135
272
|
class MalformedQuery < ResponseError; end
|
273
|
+
|
136
274
|
class ManagerNotDefined < ResponseError; end
|
275
|
+
|
137
276
|
class MassmailRetryLimitExceeded < ResponseError; end
|
277
|
+
|
138
278
|
class MassMailLimitExceeded < ResponseError; end
|
279
|
+
|
139
280
|
class MaximumCcemailsExceeded < ResponseError; end
|
281
|
+
|
140
282
|
class MaximumDashboardComponentsExceeded < ResponseError; end
|
283
|
+
|
141
284
|
class MaximumHierarchyLevelsReached < ResponseError; end
|
285
|
+
|
142
286
|
class MaximumSizeOfAttachment < ResponseError; end
|
287
|
+
|
143
288
|
class MaximumSizeOfDocument < ResponseError; end
|
289
|
+
|
144
290
|
class MaxActionsPerRuleExceeded < ResponseError; end
|
291
|
+
|
145
292
|
class MaxActiveRulesExceeded < ResponseError; end
|
293
|
+
|
146
294
|
class MaxApprovalStepsExceeded < ResponseError; end
|
295
|
+
|
147
296
|
class MaxFormulasPerRuleExceeded < ResponseError; end
|
297
|
+
|
148
298
|
class MaxRulesExceeded < ResponseError; end
|
299
|
+
|
149
300
|
class MaxRuleEntriesExceeded < ResponseError; end
|
301
|
+
|
150
302
|
class MaxTaskDescriptionExceeded < ResponseError; end
|
303
|
+
|
151
304
|
class MaxTmRulesExceeded < ResponseError; end
|
305
|
+
|
152
306
|
class MaxTmRuleItemsExceeded < ResponseError; end
|
307
|
+
|
153
308
|
class MergeFailed < ResponseError; end
|
309
|
+
|
310
|
+
class MethodNotAllowed < ResponseError; end
|
311
|
+
|
154
312
|
class MissingArgument < ResponseError; end
|
313
|
+
|
155
314
|
class NonuniqueShippingAddress < ResponseError; end
|
315
|
+
|
156
316
|
class NoApplicableProcess < ResponseError; end
|
317
|
+
|
157
318
|
class NoAttachmentPermission < ResponseError; end
|
319
|
+
|
158
320
|
class NoInactiveDivisionMembers < ResponseError; end
|
321
|
+
|
159
322
|
class NoMassMailPermission < ResponseError; end
|
323
|
+
|
160
324
|
class NumberOutsideValidRange < ResponseError; end
|
325
|
+
|
161
326
|
class NumHistoryFieldsBySobjectExceeded < ResponseError; end
|
327
|
+
|
162
328
|
class OpWithInvalidUserTypeException < ResponseError; end
|
329
|
+
|
163
330
|
class OptedOutOfMassMail < ResponseError; end
|
331
|
+
|
164
332
|
class PackageLicenseRequired < ResponseError; end
|
333
|
+
|
165
334
|
class PlatformEventEncryptionError < ResponseError; end
|
335
|
+
|
166
336
|
class PlatformEventPublishingUnavailable < ResponseError; end
|
337
|
+
|
167
338
|
class PlatformEventPublishFailed < ResponseError; end
|
339
|
+
|
168
340
|
class PortalUserAlreadyExistsForContact < ResponseError; end
|
341
|
+
|
169
342
|
class PrivateContactOnAsset < ResponseError; end
|
343
|
+
|
344
|
+
class QueryTimeout < ResponseError; end
|
345
|
+
|
170
346
|
class RecordInUseByWorkflow < ResponseError; end
|
347
|
+
|
171
348
|
class RequestLimitExceeded < ResponseError; end
|
349
|
+
|
172
350
|
class RequestRunningTooLong < ResponseError; end
|
351
|
+
|
173
352
|
class RequiredFieldMissing < ResponseError; end
|
353
|
+
|
174
354
|
class SelfReferenceFromTrigger < ResponseError; end
|
355
|
+
|
175
356
|
class ServerUnavailable < ResponseError; end
|
357
|
+
|
176
358
|
class ShareNeededForChildOwner < ResponseError; end
|
359
|
+
|
177
360
|
class SingleEmailLimitExceeded < ResponseError; end
|
361
|
+
|
178
362
|
class StandardPriceNotDefined < ResponseError; end
|
363
|
+
|
179
364
|
class StorageLimitExceeded < ResponseError; end
|
365
|
+
|
180
366
|
class StringTooLong < ResponseError; end
|
367
|
+
|
181
368
|
class TabsetLimitExceeded < ResponseError; end
|
369
|
+
|
182
370
|
class TemplateNotActive < ResponseError; end
|
371
|
+
|
183
372
|
class TerritoryRealignInProgress < ResponseError; end
|
373
|
+
|
184
374
|
class TextDataOutsideSupportedCharset < ResponseError; end
|
375
|
+
|
185
376
|
class TooManyApexRequests < ResponseError; end
|
377
|
+
|
186
378
|
class TooManyEnumValue < ResponseError; end
|
379
|
+
|
187
380
|
class TransferRequiresRead < ResponseError; end
|
381
|
+
|
188
382
|
class UnableToLockRow < ResponseError; end
|
383
|
+
|
189
384
|
class UnavailableRecordtypeException < ResponseError; end
|
385
|
+
|
190
386
|
class UndeleteFailed < ResponseError; end
|
387
|
+
|
191
388
|
class UnknownException < ResponseError; end
|
389
|
+
|
192
390
|
class UnspecifiedEmailAddress < ResponseError; end
|
391
|
+
|
193
392
|
class UnsupportedApexTriggerOperation < ResponseError; end
|
393
|
+
|
194
394
|
class UnverifiedSenderAddress < ResponseError; end
|
395
|
+
|
195
396
|
class WeblinkSizeLimitExceeded < ResponseError; end
|
397
|
+
|
196
398
|
class WeblinkUrlInvalid < ResponseError; end
|
399
|
+
|
197
400
|
class WrongControllerType < ResponseError; end
|
198
401
|
|
199
402
|
# Maps `errorCode`s returned from Salesforce to the exception class
|
@@ -201,7 +404,9 @@ module Restforce
|
|
201
404
|
ERROR_EXCEPTION_CLASSES = {
|
202
405
|
"ALL_OR_NONE_OPERATION_ROLLED_BACK" => AllOrNoneOperationRolledBack,
|
203
406
|
"ALREADY_IN_PROCESS" => AlreadyInProcess,
|
407
|
+
"APEX_ERROR" => ApexError,
|
204
408
|
"API_CURRENTLY_DISABLED" => ApiCurrentlyDisabled,
|
409
|
+
"API_DISABLED_FOR_ORG" => ApiDisabledForOrg,
|
205
410
|
"ASSIGNEE_TYPE_REQUIRED" => AssigneeTypeRequired,
|
206
411
|
"BAD_CUSTOM_ENTITY_PARENT_DOMAIN" => BadCustomEntityParentDomain,
|
207
412
|
"BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED" =>
|
@@ -218,6 +423,7 @@ module Restforce
|
|
218
423
|
"CANNOT_DELETE_MANAGED_OBJECT" => CannotDeleteManagedObject,
|
219
424
|
"CANNOT_DISABLE_LAST_ADMIN" => CannotDisableLastAdmin,
|
220
425
|
"CANNOT_ENABLE_IP_RESTRICT_REQUESTS" => CannotEnableIpRestrictRequests,
|
426
|
+
"CANNOT_EXECUTE_FLOW_TRIGGER" => CannotExecuteFlowTrigger,
|
221
427
|
"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" => CannotInsertUpdateActivateEntity,
|
222
428
|
"CANNOT_MODIFY_MANAGED_OBJECT" => CannotModifyManagedObject,
|
223
429
|
"CANNOT_RENAME_APEX_REFERENCED_FIELD" => CannotRenameApexReferencedField,
|
@@ -271,8 +477,11 @@ module Restforce
|
|
271
477
|
"FAILED_ACTIVATION" => FailedActivation,
|
272
478
|
"FIELD_CUSTOM_VALIDATION_EXCEPTION" => FieldCustomValidationException,
|
273
479
|
"FIELD_FILTER_VALIDATION_EXCEPTION" => FieldFilterValidationException,
|
480
|
+
"FIELD_INTEGRITY_EXCEPTION" => FieldIntegrityException,
|
274
481
|
"FILTERED_LOOKUP_LIMIT_EXCEEDED" => FilteredLookupLimitExceeded,
|
482
|
+
"FORBIDDEN" => Forbidden,
|
275
483
|
"HTML_FILE_UPLOAD_NOT_ALLOWED" => HtmlFileUploadNotAllowed,
|
484
|
+
"ILLEGAL_QUERY_PARAMETER_VALUE" => IllegalQueryParameterValue,
|
276
485
|
"IMAGE_TOO_LARGE" => ImageTooLarge,
|
277
486
|
"INACTIVE_OWNER_OR_USER" => InactiveOwnerOrUser,
|
278
487
|
"INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE" =>
|
@@ -305,10 +514,12 @@ module Restforce
|
|
305
514
|
"INVALID_MASTER_OR_TRANSLATED_SOLUTION" => InvalidMasterOrTranslatedSolution,
|
306
515
|
"INVALID_MESSAGE_ID_REFERENCE" => InvalidMessageIdReference,
|
307
516
|
"INVALID_OPERATION" => InvalidOperation,
|
517
|
+
"INVALID_OPERATION_WITH_EXPIRED_PASSWORD" => InvalidOperationWithExpiredPassword,
|
308
518
|
"INVALID_OPERATOR" => InvalidOperator,
|
309
519
|
"INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST" =>
|
310
520
|
InvalidOrNullForRestrictedPicklist,
|
311
521
|
"INVALID_QUERY_FILTER_OPERATOR" => InvalidQueryFilterOperator,
|
522
|
+
"INVALID_QUERY_LOCATOR" => InvalidQueryLocator,
|
312
523
|
"INVALID_PARTNER_NETWORK_STATUS" => InvalidPartnerNetworkStatus,
|
313
524
|
"INVALID_PERSON_ACCOUNT_OPERATION" => InvalidPersonAccountOperation,
|
314
525
|
"INVALID_READ_ONLY_USER_DML" => InvalidReadOnlyUserDml,
|
@@ -320,6 +531,7 @@ module Restforce
|
|
320
531
|
"INVALID_TYPE_ON_FIELD_IN_RECORD" => InvalidTypeOnFieldInRecord,
|
321
532
|
"IP_RANGE_LIMIT_EXCEEDED" => IpRangeLimitExceeded,
|
322
533
|
"JIGSAW_IMPORT_LIMIT_EXCEEDED" => JigsawImportLimitExceeded,
|
534
|
+
"JSON_PARSER_ERROR" => JsonParserError,
|
323
535
|
"LICENSE_LIMIT_EXCEEDED" => LicenseLimitExceeded,
|
324
536
|
"LIGHT_PORTAL_USER_EXCEPTION" => LightPortalUserException,
|
325
537
|
"LIMIT_EXCEEDED" => LimitExceeded,
|
@@ -346,6 +558,7 @@ module Restforce
|
|
346
558
|
"MAX_TM_RULES_EXCEEDED" => MaxTmRulesExceeded,
|
347
559
|
"MAX_TM_RULE_ITEMS_EXCEEDED" => MaxTmRuleItemsExceeded,
|
348
560
|
"MERGE_FAILED" => MergeFailed,
|
561
|
+
"METHOD_NOT_ALLOWED" => MethodNotAllowed,
|
349
562
|
"MISSING_ARGUMENT" => MissingArgument,
|
350
563
|
"NONUNIQUE_SHIPPING_ADDRESS" => NonuniqueShippingAddress,
|
351
564
|
"NO_APPLICABLE_PROCESS" => NoApplicableProcess,
|
@@ -362,6 +575,7 @@ module Restforce
|
|
362
575
|
"PLATFORM_EVENT_PUBLISH_FAILED" => PlatformEventPublishFailed,
|
363
576
|
"PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT" => PortalUserAlreadyExistsForContact,
|
364
577
|
"PRIVATE_CONTACT_ON_ASSET" => PrivateContactOnAsset,
|
578
|
+
"QUERY_TIMEOUT" => QueryTimeout,
|
365
579
|
"RECORD_IN_USE_BY_WORKFLOW" => RecordInUseByWorkflow,
|
366
580
|
"REQUEST_LIMIT_EXCEEDED" => RequestLimitExceeded,
|
367
581
|
"REQUEST_RUNNING_TOO_LONG" => RequestRunningTooLong,
|
@@ -395,9 +609,9 @@ module Restforce
|
|
395
609
|
def self.get_exception_class(error_code)
|
396
610
|
ERROR_EXCEPTION_CLASSES.fetch(error_code) do |_|
|
397
611
|
warn "[restforce] An unrecognised error code, `#{error_code}` has been " \
|
398
|
-
|
399
|
-
|
400
|
-
|
612
|
+
"received from Salesforce. Instead of raising an error-specific exception" \
|
613
|
+
", we'll raise a generic `ResponseError`. Please report this missing " \
|
614
|
+
"error code on GitHub at <#{GITHUB_ISSUE_URL}>."
|
401
615
|
|
402
616
|
# If we've received an unexpected error where we don't have a specific
|
403
617
|
# class defined, we can return a generic ResponseError instead
|
@@ -407,10 +621,10 @@ module Restforce
|
|
407
621
|
|
408
622
|
def self.const_missing(constant_name)
|
409
623
|
warn "[restforce] You're referring to a Restforce error that isn't defined, " \
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
624
|
+
"`#{name}::#{constant_name}` (for example by trying to `rescue` it). This " \
|
625
|
+
"might be our fault - we've recently made some changes to how errors are " \
|
626
|
+
"defined. If you're sure that this is a valid Salesforce error, then " \
|
627
|
+
"please create an issue on GitHub at <#{GITHUB_ISSUE_URL}>."
|
414
628
|
|
415
629
|
super(constant_name)
|
416
630
|
end
|