restforce 4.3.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +9 -9
- data/.github/ISSUE_TEMPLATE/unhandled-salesforce-error.md +17 -0
- data/.rubocop.yml +4 -3
- data/CHANGELOG.md +17 -2
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -1
- data/README.md +40 -19
- data/UPGRADING.md +38 -0
- data/lib/restforce.rb +4 -7
- data/lib/restforce/collection.rb +5 -0
- data/lib/restforce/concerns/api.rb +1 -1
- data/lib/restforce/concerns/caching.rb +7 -0
- data/lib/restforce/config.rb +3 -0
- data/lib/restforce/error_code.rb +406 -0
- data/lib/restforce/file_part.rb +24 -0
- data/lib/restforce/middleware/caching.rb +1 -1
- data/lib/restforce/middleware/raise_error.rb +3 -4
- data/lib/restforce/version.rb +1 -1
- data/restforce.gemspec +11 -12
- data/spec/integration/abstract_client_spec.rb +16 -4
- data/spec/spec_helper.rb +14 -1
- data/spec/support/fixture_helpers.rb +1 -3
- data/spec/unit/collection_spec.rb +18 -0
- data/spec/unit/concerns/caching_spec.rb +26 -0
- data/spec/unit/concerns/connection_spec.rb +2 -2
- data/spec/unit/error_code_spec.rb +61 -0
- data/spec/unit/middleware/authentication_spec.rb +7 -5
- data/spec/unit/middleware/raise_error_spec.rb +9 -0
- data/spec/unit/signed_request_spec.rb +1 -1
- metadata +28 -37
- data/lib/restforce/upload_io.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c668433781a24af5211bf9c102e5601ef69919a856928fb4a876de43bb96fa14
|
4
|
+
data.tar.gz: 5d5ee573dc491e1eb38703028d2c107d28a9fa2b37616f08e3004cc20c653868
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f938c2e517cb05c33c4526c04c0384edaa70f39bed1a391a58032fb52574fd50c20fab21f859439957070506d4c03d84447134885e14d5ad59f3bff02f689545
|
7
|
+
data.tar.gz: f2c466b8d4ae41bc6519dfaa27dbdbae2e302ad99c1ca52456f94bc391f243f99037bad48fc58533b83bb9cb146a30580e0cbe79a91cd9872e70fd0c9775865d
|
data/.circleci/config.yml
CHANGED
@@ -34,23 +34,23 @@ references:
|
|
34
34
|
destination: test-results
|
35
35
|
|
36
36
|
jobs:
|
37
|
-
build-
|
37
|
+
build-ruby271:
|
38
38
|
docker:
|
39
|
-
- image: circleci/ruby:2.
|
39
|
+
- image: circleci/ruby:2.7.1
|
40
40
|
steps: *steps
|
41
|
-
build-
|
41
|
+
build-ruby266:
|
42
42
|
docker:
|
43
|
-
- image: circleci/ruby:2.
|
43
|
+
- image: circleci/ruby:2.6.6
|
44
44
|
steps: *steps
|
45
|
-
build-
|
45
|
+
build-ruby258:
|
46
46
|
docker:
|
47
|
-
- image: circleci/ruby:2.
|
47
|
+
- image: circleci/ruby:2.5.8
|
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-ruby271
|
55
|
+
- build-ruby266
|
56
|
+
- build-ruby258
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
name: Unhandled Salesforce error
|
3
|
+
about: We've recently changed the way we handle Salesforce errors to define them ahead
|
4
|
+
of time, rather than dynamically. This might mean we're missing some errors. Please
|
5
|
+
use this template to report them.
|
6
|
+
title: 'Unhandled Salesforce error: <insert error code here>'
|
7
|
+
labels: bug
|
8
|
+
assignees: timrogers
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
Restforce doesn't have a definition for the error code `INSERT ERROR CODE HERE`.
|
13
|
+
|
14
|
+
I discovered this missing error code because:
|
15
|
+
|
16
|
+
- [ ] I tried to `rescue` it or refer to it in my code
|
17
|
+
- [ ] I got this error back from Salesforce
|
data/.rubocop.yml
CHANGED
@@ -7,10 +7,11 @@ AllCops:
|
|
7
7
|
Exclude:
|
8
8
|
- .*/**/*
|
9
9
|
- vendor/**/*
|
10
|
-
|
10
|
+
NewCops: enable
|
11
|
+
TargetRubyVersion: 2.5
|
11
12
|
|
12
|
-
# Limit lines to
|
13
|
-
|
13
|
+
# Limit lines to 90 characters.
|
14
|
+
Layout/LineLength:
|
14
15
|
Max: 90
|
15
16
|
|
16
17
|
Metrics/ClassLength:
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
|
-
##
|
1
|
+
## 5.0.0 (Jul 10, 2020)
|
2
|
+
|
3
|
+
For instructions on upgrading from Restforce 4.x to 5.x, see our ["Upgrading from Restforce 4.x to 5.x"](https://github.com/restforce/restforce/blob/master/UPGRADING.md) guide.
|
4
|
+
|
5
|
+
### Breaking changes
|
6
|
+
|
7
|
+
* __⚠️ Define exception classes for Salesforce errors up-front instead of dynamically at runtime__, *running the risk that we might miss some errors which should be defined*. If any errors are missed, they will be added in patch versions (e.g. `5.0.1`). For more details on this change, see the ["Upgrading from Restforce 4.x to 5.x"](https://github.com/restforce/restforce/blob/master/UPGRADING.md) guide (@presidentbeef, @timrogers).
|
8
|
+
* __⚠️ Deprecate support for Ruby 2.4__, since [Ruby 2.4 reached its end-of-life](https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/) in April 2020 (@timrogers)
|
9
|
+
* __⚠️ Change the ancestry of `Restforce::UnauthorizedError` so it inherits from `Faraday::ClientError`, not `Restforce::Error`__. This breaking change was required to expose the response body returned by the API as part of this error - see the non-breaking changes entry below for further details (@michaldbianchi).
|
10
|
+
|
11
|
+
### Non-breaking changes
|
12
|
+
|
13
|
+
* Add support for `lostisland/faraday` v1.x, whilst maintaining support for v0.9.x (@ryansch)
|
14
|
+
* Add `#empty?` method to `Restforce::Collection`, returning whether they are any items in a collection (@bubaflub)
|
15
|
+
* Allow opting-in to caching on a per-call basis with `Restforce::Client#with_caching` (@swaincreates)
|
16
|
+
* Expose the response body from Salesforce on `Restforce::UnauthorizedError` and `Restforce::NotFoundError` (@michaeldbianchi)
|
17
|
+
* Remove the unnecessary depending on the `json` gem, which has been part of the Ruby standard library since v1.9 (@vonTronje)
|
2
18
|
|
3
|
-
* Add compatability with Faraday versions up to but not including `v1.1.0` (@hongtron)
|
4
19
|
|
5
20
|
## 4.2.2 (Jan 23, 2020)
|
6
21
|
|
data/CONTRIBUTING.md
CHANGED
@@ -34,4 +34,4 @@ Some things that will increase the chance that your pull request is accepted:
|
|
34
34
|
* Write tests.
|
35
35
|
* Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
36
36
|
|
37
|
-
*Adapted from [
|
37
|
+
*Adapted from [factory_bot_rails's CONTRIBUTING.md](https://github.com/thoughtbot/factory_bot_rails/blob/master/CONTRIBUTING.md).*
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Restforce is a ruby gem for the [Salesforce REST api](http://www.salesforce.com/
|
|
8
8
|
Features include:
|
9
9
|
|
10
10
|
* A clean and modular architecture using [Faraday middleware](https://github.com/technoweenie/faraday) and [Hashie::Mash](https://github.com/intridea/hashie/tree/v1.2.0)'d responses.
|
11
|
-
* Support for interacting with multiple users from different
|
11
|
+
* Support for interacting with multiple users from different organizations.
|
12
12
|
* Support for parent-to-child relationships.
|
13
13
|
* Support for aggregate queries.
|
14
14
|
* Support for the [Streaming API](#streaming)
|
@@ -19,13 +19,13 @@ Features include:
|
|
19
19
|
* Support for dependent picklists.
|
20
20
|
* Support for decoding [Force.com Canvas](http://www.salesforce.com/us/developer/docs/platform_connectpre/canvas_framework.pdf) signed requests. (NEW!)
|
21
21
|
|
22
|
-
[Official Website](
|
22
|
+
[Official Website](https://restforce.github.io/) | [Documentation](http://rubydoc.info/gems/restforce/frames) | [Changelog](https://github.com/restforce/restforce/tree/master/CHANGELOG.md)
|
23
23
|
|
24
24
|
## Installation
|
25
25
|
|
26
26
|
Add this line to your application's Gemfile:
|
27
27
|
|
28
|
-
gem 'restforce', '~>
|
28
|
+
gem 'restforce', '~> 5.0.0'
|
29
29
|
|
30
30
|
And then execute:
|
31
31
|
|
@@ -35,7 +35,12 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
$ gem install restforce
|
37
37
|
|
38
|
-
__As of
|
38
|
+
__As of version 5.0.0, this gem is only compatible with Ruby 2.5.0 and later.__ If you're using an earlier Ruby version:
|
39
|
+
|
40
|
+
* for Ruby 2.4, use version 4.2.2 or earlier
|
41
|
+
* for Ruby 2.3, use version 3.2.0 or earlier
|
42
|
+
* for Ruby versions 2.2, 2.1 and 2.0, use version 2.5.3 or earlier
|
43
|
+
* for Ruby 1.9.3, use version 2.4.2
|
39
44
|
|
40
45
|
This gem is versioned using [Semantic Versioning](http://semver.org/), so you can be confident when updating that there will not be breaking changes outside of a major version (following format MAJOR.MINOR.PATCH, so for instance moving from 3.1.0 to 4.0.0 would be allowed to include incompatible API changes). See the [changelog](https://github.com/restforce/restforce/tree/master/CHANGELOG.md) for details on what has changed in each version.
|
41
46
|
|
@@ -48,7 +53,7 @@ so you can do things like `client.query('select Id, (select Name from Children__
|
|
48
53
|
### Initialization
|
49
54
|
|
50
55
|
Which authentication method you use really depends on your use case. If you're
|
51
|
-
building an application where many users from different
|
56
|
+
building an application where many users from different organizations are authenticated
|
52
57
|
through oauth and you need to interact with data in their org on their behalf,
|
53
58
|
you should use the OAuth token authentication method.
|
54
59
|
|
@@ -78,7 +83,7 @@ client = Restforce.new(oauth_token: 'access_token',
|
|
78
83
|
api_version: '41.0')
|
79
84
|
```
|
80
85
|
|
81
|
-
The middleware will use the `refresh_token` automatically to acquire a new `access_token` if the existing `access_token` is invalid.
|
86
|
+
The middleware will use the `refresh_token` automatically to acquire a new `access_token` if the existing `access_token` is invalid. The refresh process uses the `host` option so make sure that is set correctly for sandbox organizations.
|
82
87
|
|
83
88
|
`authentication_callback` is a proc that handles the response from Salesforce when the `refresh_token` is used to obtain a new `access_token`. This allows the `access_token` to be saved for re-use later - otherwise subsequent API calls will continue the cycle of "auth failure/issue new access_token/auth success".
|
84
89
|
|
@@ -142,7 +147,17 @@ export SALESFORCE_API_VERSION="41.0"
|
|
142
147
|
client = Restforce.new
|
143
148
|
```
|
144
149
|
|
145
|
-
|
150
|
+
#### Sandbox Organizations
|
151
|
+
|
152
|
+
You can connect to sandbox organizations by specifying a host. The default host is
|
153
|
+
'login.salesforce.com':
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
client = Restforce.new(host: 'test.salesforce.com')
|
157
|
+
```
|
158
|
+
The host can also be set with the environment variable `SALESFORCE_HOST`.
|
159
|
+
|
160
|
+
#### Proxy Support
|
146
161
|
|
147
162
|
You can specify a HTTP proxy using the `proxy_uri` option, as follows, or by setting the `SALESFORCE_PROXY_URI` environment variable:
|
148
163
|
|
@@ -158,16 +173,6 @@ client = Restforce.new(username: 'foo',
|
|
158
173
|
|
159
174
|
You may specify a username and password for the proxy with a URL along the lines of 'http://user:password@proxy.example.com:123'.
|
160
175
|
|
161
|
-
#### Sandbox Orgs
|
162
|
-
|
163
|
-
You can connect to sandbox orgs by specifying a host. The default host is
|
164
|
-
'login.salesforce.com':
|
165
|
-
|
166
|
-
```ruby
|
167
|
-
client = Restforce.new(host: 'test.salesforce.com')
|
168
|
-
```
|
169
|
-
The host can also be set with the environment variable `SALESFORCE_HOST`.
|
170
|
-
|
171
176
|
#### Global configuration
|
172
177
|
|
173
178
|
You can set any of the options passed into `Restforce.new` globally:
|
@@ -457,7 +462,7 @@ Using the new [Blob Data](http://www.salesforce.com/us/developer/docs/api_rest/C
|
|
457
462
|
client.create('Document', FolderId: '00lE0000000FJ6H',
|
458
463
|
Description: 'Document test',
|
459
464
|
Name: 'My image',
|
460
|
-
Body: Restforce::
|
465
|
+
Body: Restforce::FilePart.new(File.expand_path('image.jpg', __FILE__), 'image/jpeg')
|
461
466
|
```
|
462
467
|
|
463
468
|
Using base64 encoded data (37.5mb limit):
|
@@ -688,7 +693,23 @@ client.without_caching do
|
|
688
693
|
end
|
689
694
|
```
|
690
695
|
|
691
|
-
|
696
|
+
If you prefer to opt in to caching on a per-request, you can do so by using .with_caching and
|
697
|
+
setting the `use_cache` config option to false:
|
698
|
+
|
699
|
+
```ruby
|
700
|
+
Restforce.configure do |config|
|
701
|
+
config.cache = Rails.cache
|
702
|
+
config.use_cache = false
|
703
|
+
end
|
704
|
+
```
|
705
|
+
|
706
|
+
```ruby
|
707
|
+
client.with_caching do
|
708
|
+
client.query('select Id from Account')
|
709
|
+
end
|
710
|
+
```
|
711
|
+
|
712
|
+
Caching is done based on your authentication credentials, so cached responses will not be shared between different Salesforce logins.
|
692
713
|
|
693
714
|
* * *
|
694
715
|
|
data/UPGRADING.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Upgrading from Restforce 4.x to 5.x
|
2
|
+
|
3
|
+
__There are three breaking changes introduced in Restforce 5.x__. In this guide, you'll learn about these changes and what you should check in your code to make sure that it will work with the latest version of the library.
|
4
|
+
|
5
|
+
## Error classes are now defined up-front, rather than dynamically at runtime
|
6
|
+
|
7
|
+
__Likelyhood of impact__: Moderate
|
8
|
+
|
9
|
+
The Salesforce REST API can return a range of `errorCode`s representing different kinds of errors. To make these easy to
|
10
|
+
handle in your code, we want to turn these into individual, specific exception classes in the `Restforce::ErrorCode` namespace that inherit from `Restforce:: ResponseError`.
|
11
|
+
|
12
|
+
Up until now, these exception classes have been defined dynamically at runtime which has some disadvantages - see the [pull request](https://github.com/restforce/restforce/pull/551) for more details.
|
13
|
+
|
14
|
+
In this version, we switch to defining them up-front in the code based on a list in the Salesforce documentation. There is a risk that we might have missed some errors which should be defined. If any errors are missed, they will be added in patch versions (e.g. `5.0.1`).
|
15
|
+
|
16
|
+
If your application won't run because you are referring to an exception class that no longer exists, or you see warnings logged anywhere, please [create an issue](https://github.com/restforce/restforce/issues/new?template=unhandled-salesforce-error.md&title=Unhandled+Salesforce+error%3A+%3Cinsert+error+code+here%3E).
|
17
|
+
|
18
|
+
## Ruby 2.4 is no longer supported
|
19
|
+
|
20
|
+
__Likelyhood of impact__: Moderate
|
21
|
+
|
22
|
+
As of [5th April 2020](https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/), Ruby 2.4 is no longer officially supported as an active version of the Ruby language. That means that it will not receive patches and security fixes.
|
23
|
+
|
24
|
+
Accordingly, we've dropped support for Ruby 2.4 and earlier in the Restforce library. It *may* be compatible, bu we don't guarantee this or enforce it with automated tests.
|
25
|
+
|
26
|
+
Before you update to Restforce 5.x, you'll need to switch to Ruby 2.5 or later. The current version of Ruby at the time of wriing is 2.7.
|
27
|
+
|
28
|
+
## `Restforce::UnauthorizedError` no longer inherits from `Restforce::Error`
|
29
|
+
|
30
|
+
__Likelyhood of impact__: Low
|
31
|
+
|
32
|
+
Previously, the `Restforce::UnauthorizedError` returned when the library couldn't authenticate with the Salesforce API inherits from `Restforce::Error`. So, if you used `rescue Restforce::Error` in your code, you'd catch these exceptions.
|
33
|
+
|
34
|
+
We've now changed this exception class to inherit from `Faraday::ClientError` which allows the response body returned from the Salesforce API to be attached to the error.
|
35
|
+
|
36
|
+
If you refer to `Restforce::Error` anywhere in your code, you should check whether you also need to take into account `Restforce::UnauthorizedError`.
|
37
|
+
|
38
|
+
If you refer to `Faraday::ClientError` anywhere in your code, you should check that you want the case where Restforce can't authenticate to be included.
|
data/lib/restforce.rb
CHANGED
@@ -15,7 +15,8 @@ module Restforce
|
|
15
15
|
autoload :Middleware, 'restforce/middleware'
|
16
16
|
autoload :Attachment, 'restforce/attachment'
|
17
17
|
autoload :Document, 'restforce/document'
|
18
|
-
autoload :
|
18
|
+
autoload :FilePart, 'restforce/file_part'
|
19
|
+
autoload :UploadIO, 'restforce/file_part' # Deprecated
|
19
20
|
autoload :SObject, 'restforce/sobject'
|
20
21
|
autoload :Client, 'restforce/client'
|
21
22
|
autoload :Mash, 'restforce/mash'
|
@@ -44,7 +45,7 @@ module Restforce
|
|
44
45
|
Error = Class.new(StandardError)
|
45
46
|
ServerError = Class.new(Error)
|
46
47
|
AuthenticationError = Class.new(Error)
|
47
|
-
UnauthorizedError = Class.new(
|
48
|
+
UnauthorizedError = Class.new(Faraday::ClientError)
|
48
49
|
APIVersionError = Class.new(Error)
|
49
50
|
BatchAPIError = Class.new(Error)
|
50
51
|
|
@@ -60,11 +61,7 @@ module Restforce
|
|
60
61
|
MatchesMultipleError= Class.new(ResponseError)
|
61
62
|
EntityTooLargeError = Class.new(ResponseError)
|
62
63
|
|
63
|
-
|
64
|
-
def self.const_missing(constant_name)
|
65
|
-
const_set constant_name, Class.new(ResponseError)
|
66
|
-
end
|
67
|
-
end
|
64
|
+
require 'restforce/error_code'
|
68
65
|
|
69
66
|
class << self
|
70
67
|
# Alias for Restforce::Data::Client.new
|
data/lib/restforce/collection.rb
CHANGED
data/lib/restforce/config.rb
CHANGED
@@ -156,6 +156,9 @@ module Restforce
|
|
156
156
|
# Set a log level for logging when Restforce.log is set to true, defaulting to :debug
|
157
157
|
option :log_level, default: :debug
|
158
158
|
|
159
|
+
# Set use_cache to false to opt in to caching with client.with_caching
|
160
|
+
option :use_cache, default: true
|
161
|
+
|
159
162
|
def options
|
160
163
|
self.class.options
|
161
164
|
end
|
@@ -0,0 +1,406 @@
|
|
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%3A+%3Cinsert+" \
|
7
|
+
"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
|
+
class AlreadyInProcess < ResponseError; end
|
18
|
+
class AssigneeTypeRequired < ResponseError; end
|
19
|
+
class BadCustomEntityParentDomain < ResponseError; end
|
20
|
+
class BccNotAllowedIfBccComplianceEnabled < ResponseError; end
|
21
|
+
class BccSelfNotAllowedIfBccComplianceEnabled < ResponseError; end
|
22
|
+
class CannotCascadeProductActive < ResponseError; end
|
23
|
+
class CannotChangeFieldTypeOfApexReferencedField < ResponseError; end
|
24
|
+
class CannotCreateAnotherManagedPackage < ResponseError; end
|
25
|
+
class CannotDeactivateDivision < ResponseError; end
|
26
|
+
class CannotDeleteLastDatedConversionRate < ResponseError; end
|
27
|
+
class CannotDeleteManagedObject < ResponseError; end
|
28
|
+
class CannotDisableLastAdmin < ResponseError; end
|
29
|
+
class CannotEnableIpRestrictRequests < ResponseError; end
|
30
|
+
class CannotInsertUpdateActivateEntity < ResponseError; end
|
31
|
+
class CannotModifyManagedObject < ResponseError; end
|
32
|
+
class CannotRenameApexReferencedField < ResponseError; end
|
33
|
+
class CannotRenameApexReferencedObject < ResponseError; end
|
34
|
+
class CannotReparentRecord < ResponseError; end
|
35
|
+
class CannotResolveName < ResponseError; end
|
36
|
+
class CannotUpdateConvertedLead < ResponseError; end
|
37
|
+
class CantDisableCorpCurrency < ResponseError; end
|
38
|
+
class CantUnsetCorpCurrency < ResponseError; end
|
39
|
+
class ChildShareFailsParent < ResponseError; end
|
40
|
+
class CircularDependency < ResponseError; end
|
41
|
+
class CommunityNotAccessible < ResponseError; end
|
42
|
+
class CustomClobFieldLimitExceeded < ResponseError; end
|
43
|
+
class CustomEntityOrFieldLimit < ResponseError; end
|
44
|
+
class CustomFieldIndexLimitExceeded < ResponseError; end
|
45
|
+
class CustomIndexExists < ResponseError; end
|
46
|
+
class CustomLinkLimitExceeded < ResponseError; end
|
47
|
+
class CustomMetadataLimitExceeded < ResponseError; end
|
48
|
+
class CustomSettingsLimitExceeded < ResponseError; end
|
49
|
+
class CustomTabLimitExceeded < ResponseError; end
|
50
|
+
class DeleteFailed < ResponseError; end
|
51
|
+
class DependencyExists < ResponseError; end
|
52
|
+
class DuplicateCaseSolution < ResponseError; end
|
53
|
+
class DuplicateCustomEntityDefinition < ResponseError; end
|
54
|
+
class DuplicateCustomTabMotif < ResponseError; end
|
55
|
+
class DuplicateDeveloperName < ResponseError; end
|
56
|
+
class DuplicatesDetected < ResponseError; end
|
57
|
+
class DuplicateExternalId < ResponseError; end
|
58
|
+
class DuplicateMasterLabel < ResponseError; end
|
59
|
+
class DuplicateSenderDisplayName < ResponseError; end
|
60
|
+
class DuplicateUsername < ResponseError; end
|
61
|
+
class DuplicateValue < ResponseError; end
|
62
|
+
class EmailAddressBounced < ResponseError; end
|
63
|
+
class EmailNotProcessedDueToPriorError < ResponseError; end
|
64
|
+
class EmailOptedOut < ResponseError; end
|
65
|
+
class EmailTemplateFormulaError < ResponseError; end
|
66
|
+
class EmailTemplateMergefieldAccessError < ResponseError; end
|
67
|
+
class EmailTemplateMergefieldError < ResponseError; end
|
68
|
+
class EmailTemplateMergefieldValueError < ResponseError; end
|
69
|
+
class EmailTemplateProcessingError < ResponseError; end
|
70
|
+
class EmptyScontrolFileName < ResponseError; end
|
71
|
+
class EntityFailedIflastmodifiedOnUpdate < ResponseError; end
|
72
|
+
class EntityIsArchived < ResponseError; end
|
73
|
+
class EntityIsDeleted < ResponseError; end
|
74
|
+
class EntityIsLocked < ResponseError; end
|
75
|
+
class EnvironmentHubMembershipConflict < ResponseError; end
|
76
|
+
class ErrorInMailer < ResponseError; end
|
77
|
+
class FailedActivation < ResponseError; end
|
78
|
+
class FieldCustomValidationException < ResponseError; end
|
79
|
+
class FieldFilterValidationException < ResponseError; end
|
80
|
+
class FilteredLookupLimitExceeded < ResponseError; end
|
81
|
+
class HtmlFileUploadNotAllowed < ResponseError; end
|
82
|
+
class ImageTooLarge < ResponseError; end
|
83
|
+
class InactiveOwnerOrUser < ResponseError; end
|
84
|
+
class InsertUpdateDeleteNotAllowedDuringMaintenance < ResponseError; end
|
85
|
+
class InsufficientAccessOnCrossReferenceEntity < ResponseError; end
|
86
|
+
class InsufficientAccessOrReadonly < ResponseError; end
|
87
|
+
class InvalidAccessLevel < ResponseError; end
|
88
|
+
class InvalidArgumentType < ResponseError; end
|
89
|
+
class InvalidAssigneeType < ResponseError; end
|
90
|
+
class InvalidAssignmentRule < ResponseError; end
|
91
|
+
class InvalidBatchOperation < ResponseError; end
|
92
|
+
class InvalidContentType < ResponseError; end
|
93
|
+
class InvalidCreditCardInfo < ResponseError; end
|
94
|
+
class InvalidCrossReferenceKey < ResponseError; end
|
95
|
+
class InvalidCrossReferenceTypeForField < ResponseError; end
|
96
|
+
class InvalidCurrencyConvRate < ResponseError; end
|
97
|
+
class InvalidCurrencyCorpRate < ResponseError; end
|
98
|
+
class InvalidCurrencyIso < ResponseError; end
|
99
|
+
class InvalidEmailAddress < ResponseError; end
|
100
|
+
class InvalidEmptyKeyOwner < ResponseError; end
|
101
|
+
class InvalidEventSubscription < ResponseError; end
|
102
|
+
class InvalidField < ResponseError; end
|
103
|
+
class InvalidFieldForInsertUpdate < ResponseError; end
|
104
|
+
class InvalidFieldWhenUsingTemplate < ResponseError; end
|
105
|
+
class InvalidFilterAction < ResponseError; end
|
106
|
+
class InvalidIdField < ResponseError; end
|
107
|
+
class InvalidInetAddress < ResponseError; end
|
108
|
+
class InvalidLineitemCloneState < ResponseError; end
|
109
|
+
class InvalidMasterOrTranslatedSolution < ResponseError; end
|
110
|
+
class InvalidMessageIdReference < ResponseError; end
|
111
|
+
class InvalidOperation < ResponseError; end
|
112
|
+
class InvalidOperator < ResponseError; end
|
113
|
+
class InvalidOrNullForRestrictedPicklist < ResponseError; end
|
114
|
+
class InvalidPartnerNetworkStatus < ResponseError; end
|
115
|
+
class InvalidPersonAccountOperation < ResponseError; end
|
116
|
+
class InvalidReadOnlyUserDml < ResponseError; end
|
117
|
+
class InvalidSaveAsActivityFlag < ResponseError; end
|
118
|
+
class InvalidSessionId < ResponseError; end
|
119
|
+
class InvalidStatus < ResponseError; end
|
120
|
+
class InvalidType < ResponseError; end
|
121
|
+
class InvalidTypeForOperation < ResponseError; end
|
122
|
+
class InvalidTypeOnFieldInRecord < ResponseError; end
|
123
|
+
class IpRangeLimitExceeded < ResponseError; end
|
124
|
+
class JigsawImportLimitExceeded < ResponseError; end
|
125
|
+
class LicenseLimitExceeded < ResponseError; end
|
126
|
+
class LightPortalUserException < ResponseError; end
|
127
|
+
class LimitExceeded < ResponseError; end
|
128
|
+
class LoginChallengeIssued < ResponseError; end
|
129
|
+
class LoginChallengePending < ResponseError; end
|
130
|
+
class LoginMustUseSecurityToken < ResponseError; end
|
131
|
+
class MalformedId < ResponseError; end
|
132
|
+
class ManagerNotDefined < ResponseError; end
|
133
|
+
class MassmailRetryLimitExceeded < ResponseError; end
|
134
|
+
class MassMailLimitExceeded < ResponseError; end
|
135
|
+
class MaximumCcemailsExceeded < ResponseError; end
|
136
|
+
class MaximumDashboardComponentsExceeded < ResponseError; end
|
137
|
+
class MaximumHierarchyLevelsReached < ResponseError; end
|
138
|
+
class MaximumSizeOfAttachment < ResponseError; end
|
139
|
+
class MaximumSizeOfDocument < ResponseError; end
|
140
|
+
class MaxActionsPerRuleExceeded < ResponseError; end
|
141
|
+
class MaxActiveRulesExceeded < ResponseError; end
|
142
|
+
class MaxApprovalStepsExceeded < ResponseError; end
|
143
|
+
class MaxFormulasPerRuleExceeded < ResponseError; end
|
144
|
+
class MaxRulesExceeded < ResponseError; end
|
145
|
+
class MaxRuleEntriesExceeded < ResponseError; end
|
146
|
+
class MaxTaskDescriptionExceeded < ResponseError; end
|
147
|
+
class MaxTmRulesExceeded < ResponseError; end
|
148
|
+
class MaxTmRuleItemsExceeded < ResponseError; end
|
149
|
+
class MergeFailed < ResponseError; end
|
150
|
+
class MissingArgument < ResponseError; end
|
151
|
+
class NonuniqueShippingAddress < ResponseError; end
|
152
|
+
class NoApplicableProcess < ResponseError; end
|
153
|
+
class NoAttachmentPermission < ResponseError; end
|
154
|
+
class NoInactiveDivisionMembers < ResponseError; end
|
155
|
+
class NoMassMailPermission < ResponseError; end
|
156
|
+
class NumberOutsideValidRange < ResponseError; end
|
157
|
+
class NumHistoryFieldsBySobjectExceeded < ResponseError; end
|
158
|
+
class OpWithInvalidUserTypeException < ResponseError; end
|
159
|
+
class OptedOutOfMassMail < ResponseError; end
|
160
|
+
class PackageLicenseRequired < ResponseError; end
|
161
|
+
class PlatformEventEncryptionError < ResponseError; end
|
162
|
+
class PlatformEventPublishingUnavailable < ResponseError; end
|
163
|
+
class PlatformEventPublishFailed < ResponseError; end
|
164
|
+
class PortalUserAlreadyExistsForContact < ResponseError; end
|
165
|
+
class PrivateContactOnAsset < ResponseError; end
|
166
|
+
class RecordInUseByWorkflow < ResponseError; end
|
167
|
+
class RequestRunningTooLong < ResponseError; end
|
168
|
+
class RequiredFieldMissing < ResponseError; end
|
169
|
+
class SelfReferenceFromTrigger < ResponseError; end
|
170
|
+
class ShareNeededForChildOwner < ResponseError; end
|
171
|
+
class SingleEmailLimitExceeded < ResponseError; end
|
172
|
+
class StandardPriceNotDefined < ResponseError; end
|
173
|
+
class StorageLimitExceeded < ResponseError; end
|
174
|
+
class StringTooLong < ResponseError; end
|
175
|
+
class TabsetLimitExceeded < ResponseError; end
|
176
|
+
class TemplateNotActive < ResponseError; end
|
177
|
+
class TerritoryRealignInProgress < ResponseError; end
|
178
|
+
class TextDataOutsideSupportedCharset < ResponseError; end
|
179
|
+
class TooManyApexRequests < ResponseError; end
|
180
|
+
class TooManyEnumValue < ResponseError; end
|
181
|
+
class TransferRequiresRead < ResponseError; end
|
182
|
+
class UnableToLockRow < ResponseError; end
|
183
|
+
class UnavailableRecordtypeException < ResponseError; end
|
184
|
+
class UndeleteFailed < ResponseError; end
|
185
|
+
class UnknownException < ResponseError; end
|
186
|
+
class UnspecifiedEmailAddress < ResponseError; end
|
187
|
+
class UnsupportedApexTriggerOperation < ResponseError; end
|
188
|
+
class UnverifiedSenderAddress < ResponseError; end
|
189
|
+
class WeblinkSizeLimitExceeded < ResponseError; end
|
190
|
+
class WeblinkUrlInvalid < ResponseError; end
|
191
|
+
class WrongControllerType < ResponseError; end
|
192
|
+
|
193
|
+
# Maps `errorCode`s returned from Salesforce to the exception class
|
194
|
+
# to be used for these errors
|
195
|
+
ERROR_EXCEPTION_CLASSES = {
|
196
|
+
"ALL_OR_NONE_OPERATION_ROLLED_BACK" => AllOrNoneOperationRolledBack,
|
197
|
+
"ALREADY_IN_PROCESS" => AlreadyInProcess,
|
198
|
+
"ASSIGNEE_TYPE_REQUIRED" => AssigneeTypeRequired,
|
199
|
+
"BAD_CUSTOM_ENTITY_PARENT_DOMAIN" => BadCustomEntityParentDomain,
|
200
|
+
"BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED" =>
|
201
|
+
BccNotAllowedIfBccComplianceEnabled,
|
202
|
+
"BCC_SELF_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED" =>
|
203
|
+
BccSelfNotAllowedIfBccComplianceEnabled,
|
204
|
+
"CANNOT_CASCADE_PRODUCT_ACTIVE" => CannotCascadeProductActive,
|
205
|
+
"CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD" =>
|
206
|
+
CannotChangeFieldTypeOfApexReferencedField,
|
207
|
+
"CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE" => CannotCreateAnotherManagedPackage,
|
208
|
+
"CANNOT_DEACTIVATE_DIVISION" => CannotDeactivateDivision,
|
209
|
+
"CANNOT_DELETE_LAST_DATED_CONVERSION_RATE" =>
|
210
|
+
CannotDeleteLastDatedConversionRate,
|
211
|
+
"CANNOT_DELETE_MANAGED_OBJECT" => CannotDeleteManagedObject,
|
212
|
+
"CANNOT_DISABLE_LAST_ADMIN" => CannotDisableLastAdmin,
|
213
|
+
"CANNOT_ENABLE_IP_RESTRICT_REQUESTS" => CannotEnableIpRestrictRequests,
|
214
|
+
"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" => CannotInsertUpdateActivateEntity,
|
215
|
+
"CANNOT_MODIFY_MANAGED_OBJECT" => CannotModifyManagedObject,
|
216
|
+
"CANNOT_RENAME_APEX_REFERENCED_FIELD" => CannotRenameApexReferencedField,
|
217
|
+
"CANNOT_RENAME_APEX_REFERENCED_OBJECT" => CannotRenameApexReferencedObject,
|
218
|
+
"CANNOT_REPARENT_RECORD" => CannotReparentRecord,
|
219
|
+
"CANNOT_RESOLVE_NAME" => CannotResolveName,
|
220
|
+
"CANNOT_UPDATE_CONVERTED_LEAD" => CannotUpdateConvertedLead,
|
221
|
+
"CANT_DISABLE_CORP_CURRENCY" => CantDisableCorpCurrency,
|
222
|
+
"CANT_UNSET_CORP_CURRENCY" => CantUnsetCorpCurrency,
|
223
|
+
"CHILD_SHARE_FAILS_PARENT" => ChildShareFailsParent,
|
224
|
+
"CIRCULAR_DEPENDENCY" => CircularDependency,
|
225
|
+
"COMMUNITY_NOT_ACCESSIBLE" => CommunityNotAccessible,
|
226
|
+
"CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED" => CustomClobFieldLimitExceeded,
|
227
|
+
"CUSTOM_ENTITY_OR_FIELD_LIMIT" => CustomEntityOrFieldLimit,
|
228
|
+
"CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED" => CustomFieldIndexLimitExceeded,
|
229
|
+
"CUSTOM_INDEX_EXISTS" => CustomIndexExists,
|
230
|
+
"CUSTOM_LINK_LIMIT_EXCEEDED" => CustomLinkLimitExceeded,
|
231
|
+
"CUSTOM_METADATA_LIMIT_EXCEEDED" => CustomMetadataLimitExceeded,
|
232
|
+
"CUSTOM_SETTINGS_LIMIT_EXCEEDED" => CustomSettingsLimitExceeded,
|
233
|
+
"CUSTOM_TAB_LIMIT_EXCEEDED" => CustomTabLimitExceeded,
|
234
|
+
"DELETE_FAILED" => DeleteFailed,
|
235
|
+
"DEPENDENCY_EXISTS" => DependencyExists,
|
236
|
+
"DUPLICATE_CASE_SOLUTION" => DuplicateCaseSolution,
|
237
|
+
"DUPLICATE_CUSTOM_ENTITY_DEFINITION" => DuplicateCustomEntityDefinition,
|
238
|
+
"DUPLICATE_CUSTOM_TAB_MOTIF" => DuplicateCustomTabMotif,
|
239
|
+
"DUPLICATE_DEVELOPER_NAME" => DuplicateDeveloperName,
|
240
|
+
"DUPLICATES_DETECTED" => DuplicatesDetected,
|
241
|
+
"DUPLICATE_EXTERNAL_ID" => DuplicateExternalId,
|
242
|
+
"DUPLICATE_MASTER_LABEL" => DuplicateMasterLabel,
|
243
|
+
"DUPLICATE_SENDER_DISPLAY_NAME" => DuplicateSenderDisplayName,
|
244
|
+
"DUPLICATE_USERNAME" => DuplicateUsername,
|
245
|
+
"DUPLICATE_VALUE" => DuplicateValue,
|
246
|
+
"EMAIL_ADDRESS_BOUNCED" => EmailAddressBounced,
|
247
|
+
"EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR" => EmailNotProcessedDueToPriorError,
|
248
|
+
"EMAIL_OPTED_OUT" => EmailOptedOut,
|
249
|
+
"EMAIL_TEMPLATE_FORMULA_ERROR" => EmailTemplateFormulaError,
|
250
|
+
"EMAIL_TEMPLATE_MERGEFIELD_ACCESS_ERROR" =>
|
251
|
+
EmailTemplateMergefieldAccessError,
|
252
|
+
"EMAIL_TEMPLATE_MERGEFIELD_ERROR" => EmailTemplateMergefieldError,
|
253
|
+
"EMAIL_TEMPLATE_MERGEFIELD_VALUE_ERROR" => EmailTemplateMergefieldValueError,
|
254
|
+
"EMAIL_TEMPLATE_PROCESSING_ERROR" => EmailTemplateProcessingError,
|
255
|
+
"EMPTY_SCONTROL_FILE_NAME" => EmptyScontrolFileName,
|
256
|
+
"ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE" =>
|
257
|
+
EntityFailedIflastmodifiedOnUpdate,
|
258
|
+
"ENTITY_IS_ARCHIVED" => EntityIsArchived,
|
259
|
+
"ENTITY_IS_DELETED" => EntityIsDeleted,
|
260
|
+
"ENTITY_IS_LOCKED" => EntityIsLocked,
|
261
|
+
"ENVIRONMENT_HUB_MEMBERSHIP_CONFLICT" => EnvironmentHubMembershipConflict,
|
262
|
+
"ERROR_IN_MAILER" => ErrorInMailer,
|
263
|
+
"FAILED_ACTIVATION" => FailedActivation,
|
264
|
+
"FIELD_CUSTOM_VALIDATION_EXCEPTION" => FieldCustomValidationException,
|
265
|
+
"FIELD_FILTER_VALIDATION_EXCEPTION" => FieldFilterValidationException,
|
266
|
+
"FILTERED_LOOKUP_LIMIT_EXCEEDED" => FilteredLookupLimitExceeded,
|
267
|
+
"HTML_FILE_UPLOAD_NOT_ALLOWED" => HtmlFileUploadNotAllowed,
|
268
|
+
"IMAGE_TOO_LARGE" => ImageTooLarge,
|
269
|
+
"INACTIVE_OWNER_OR_USER" => InactiveOwnerOrUser,
|
270
|
+
"INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE" =>
|
271
|
+
InsertUpdateDeleteNotAllowedDuringMaintenance,
|
272
|
+
"INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" =>
|
273
|
+
InsufficientAccessOnCrossReferenceEntity,
|
274
|
+
"INSUFFICIENT_ACCESS_OR_READONLY" => InsufficientAccessOrReadonly,
|
275
|
+
"INVALID_ACCESS_LEVEL" => InvalidAccessLevel,
|
276
|
+
"INVALID_ARGUMENT_TYPE" => InvalidArgumentType,
|
277
|
+
"INVALID_ASSIGNEE_TYPE" => InvalidAssigneeType,
|
278
|
+
"INVALID_ASSIGNMENT_RULE" => InvalidAssignmentRule,
|
279
|
+
"INVALID_BATCH_OPERATION" => InvalidBatchOperation,
|
280
|
+
"INVALID_CONTENT_TYPE" => InvalidContentType,
|
281
|
+
"INVALID_CREDIT_CARD_INFO" => InvalidCreditCardInfo,
|
282
|
+
"INVALID_CROSS_REFERENCE_KEY" => InvalidCrossReferenceKey,
|
283
|
+
"INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD" => InvalidCrossReferenceTypeForField,
|
284
|
+
"INVALID_CURRENCY_CONV_RATE" => InvalidCurrencyConvRate,
|
285
|
+
"INVALID_CURRENCY_CORP_RATE" => InvalidCurrencyCorpRate,
|
286
|
+
"INVALID_CURRENCY_ISO" => InvalidCurrencyIso,
|
287
|
+
"INVALID_EMAIL_ADDRESS" => InvalidEmailAddress,
|
288
|
+
"INVALID_EMPTY_KEY_OWNER" => InvalidEmptyKeyOwner,
|
289
|
+
"INVALID_EVENT_SUBSCRIPTION" => InvalidEventSubscription,
|
290
|
+
"INVALID_FIELD" => InvalidField,
|
291
|
+
"INVALID_FIELD_FOR_INSERT_UPDATE" => InvalidFieldForInsertUpdate,
|
292
|
+
"INVALID_FIELD_WHEN_USING_TEMPLATE" => InvalidFieldWhenUsingTemplate,
|
293
|
+
"INVALID_FILTER_ACTION" => InvalidFilterAction,
|
294
|
+
"INVALID_ID_FIELD" => InvalidIdField,
|
295
|
+
"INVALID_INET_ADDRESS" => InvalidInetAddress,
|
296
|
+
"INVALID_LINEITEM_CLONE_STATE" => InvalidLineitemCloneState,
|
297
|
+
"INVALID_MASTER_OR_TRANSLATED_SOLUTION" => InvalidMasterOrTranslatedSolution,
|
298
|
+
"INVALID_MESSAGE_ID_REFERENCE" => InvalidMessageIdReference,
|
299
|
+
"INVALID_OPERATION" => InvalidOperation,
|
300
|
+
"INVALID_OPERATOR" => InvalidOperator,
|
301
|
+
"INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST" =>
|
302
|
+
InvalidOrNullForRestrictedPicklist,
|
303
|
+
"INVALID_PARTNER_NETWORK_STATUS" => InvalidPartnerNetworkStatus,
|
304
|
+
"INVALID_PERSON_ACCOUNT_OPERATION" => InvalidPersonAccountOperation,
|
305
|
+
"INVALID_READ_ONLY_USER_DML" => InvalidReadOnlyUserDml,
|
306
|
+
"INVALID_SAVE_AS_ACTIVITY_FLAG" => InvalidSaveAsActivityFlag,
|
307
|
+
"INVALID_SESSION_ID" => InvalidSessionId,
|
308
|
+
"INVALID_STATUS" => InvalidStatus,
|
309
|
+
"INVALID_TYPE" => InvalidType,
|
310
|
+
"INVALID_TYPE_FOR_OPERATION" => InvalidTypeForOperation,
|
311
|
+
"INVALID_TYPE_ON_FIELD_IN_RECORD" => InvalidTypeOnFieldInRecord,
|
312
|
+
"IP_RANGE_LIMIT_EXCEEDED" => IpRangeLimitExceeded,
|
313
|
+
"JIGSAW_IMPORT_LIMIT_EXCEEDED" => JigsawImportLimitExceeded,
|
314
|
+
"LICENSE_LIMIT_EXCEEDED" => LicenseLimitExceeded,
|
315
|
+
"LIGHT_PORTAL_USER_EXCEPTION" => LightPortalUserException,
|
316
|
+
"LIMIT_EXCEEDED" => LimitExceeded,
|
317
|
+
"LOGIN_CHALLENGE_ISSUED" => LoginChallengeIssued,
|
318
|
+
"LOGIN_CHALLENGE_PENDING" => LoginChallengePending,
|
319
|
+
"LOGIN_MUST_USE_SECURITY_TOKEN" => LoginMustUseSecurityToken,
|
320
|
+
"MALFORMED_ID" => MalformedId,
|
321
|
+
"MANAGER_NOT_DEFINED" => ManagerNotDefined,
|
322
|
+
"MASSMAIL_RETRY_LIMIT_EXCEEDED" => MassmailRetryLimitExceeded,
|
323
|
+
"MASS_MAIL_LIMIT_EXCEEDED" => MassMailLimitExceeded,
|
324
|
+
"MAXIMUM_CCEMAILS_EXCEEDED" => MaximumCcemailsExceeded,
|
325
|
+
"MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED" => MaximumDashboardComponentsExceeded,
|
326
|
+
"MAXIMUM_HIERARCHY_LEVELS_REACHED" => MaximumHierarchyLevelsReached,
|
327
|
+
"MAXIMUM_SIZE_OF_ATTACHMENT" => MaximumSizeOfAttachment,
|
328
|
+
"MAXIMUM_SIZE_OF_DOCUMENT" => MaximumSizeOfDocument,
|
329
|
+
"MAX_ACTIONS_PER_RULE_EXCEEDED" => MaxActionsPerRuleExceeded,
|
330
|
+
"MAX_ACTIVE_RULES_EXCEEDED" => MaxActiveRulesExceeded,
|
331
|
+
"MAX_APPROVAL_STEPS_EXCEEDED" => MaxApprovalStepsExceeded,
|
332
|
+
"MAX_FORMULAS_PER_RULE_EXCEEDED" => MaxFormulasPerRuleExceeded,
|
333
|
+
"MAX_RULES_EXCEEDED" => MaxRulesExceeded,
|
334
|
+
"MAX_RULE_ENTRIES_EXCEEDED" => MaxRuleEntriesExceeded,
|
335
|
+
"MAX_TASK_DESCRIPTION_EXCEEDED" => MaxTaskDescriptionExceeded,
|
336
|
+
"MAX_TM_RULES_EXCEEDED" => MaxTmRulesExceeded,
|
337
|
+
"MAX_TM_RULE_ITEMS_EXCEEDED" => MaxTmRuleItemsExceeded,
|
338
|
+
"MERGE_FAILED" => MergeFailed,
|
339
|
+
"MISSING_ARGUMENT" => MissingArgument,
|
340
|
+
"NONUNIQUE_SHIPPING_ADDRESS" => NonuniqueShippingAddress,
|
341
|
+
"NO_APPLICABLE_PROCESS" => NoApplicableProcess,
|
342
|
+
"NO_ATTACHMENT_PERMISSION" => NoAttachmentPermission,
|
343
|
+
"NO_INACTIVE_DIVISION_MEMBERS" => NoInactiveDivisionMembers,
|
344
|
+
"NO_MASS_MAIL_PERMISSION" => NoMassMailPermission,
|
345
|
+
"NUMBER_OUTSIDE_VALID_RANGE" => NumberOutsideValidRange,
|
346
|
+
"NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED" => NumHistoryFieldsBySobjectExceeded,
|
347
|
+
"OP_WITH_INVALID_USER_TYPE_EXCEPTION" => OpWithInvalidUserTypeException,
|
348
|
+
"OPTED_OUT_OF_MASS_MAIL" => OptedOutOfMassMail,
|
349
|
+
"PACKAGE_LICENSE_REQUIRED" => PackageLicenseRequired,
|
350
|
+
"PLATFORM_EVENT_ENCRYPTION_ERROR" => PlatformEventEncryptionError,
|
351
|
+
"PLATFORM_EVENT_PUBLISHING_UNAVAILABLE" => PlatformEventPublishingUnavailable,
|
352
|
+
"PLATFORM_EVENT_PUBLISH_FAILED" => PlatformEventPublishFailed,
|
353
|
+
"PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT" => PortalUserAlreadyExistsForContact,
|
354
|
+
"PRIVATE_CONTACT_ON_ASSET" => PrivateContactOnAsset,
|
355
|
+
"RECORD_IN_USE_BY_WORKFLOW" => RecordInUseByWorkflow,
|
356
|
+
"REQUEST_RUNNING_TOO_LONG" => RequestRunningTooLong,
|
357
|
+
"REQUIRED_FIELD_MISSING" => RequiredFieldMissing,
|
358
|
+
"SELF_REFERENCE_FROM_TRIGGER" => SelfReferenceFromTrigger,
|
359
|
+
"SHARE_NEEDED_FOR_CHILD_OWNER" => ShareNeededForChildOwner,
|
360
|
+
"SINGLE_EMAIL_LIMIT_EXCEEDED" => SingleEmailLimitExceeded,
|
361
|
+
"STANDARD_PRICE_NOT_DEFINED" => StandardPriceNotDefined,
|
362
|
+
"STORAGE_LIMIT_EXCEEDED" => StorageLimitExceeded,
|
363
|
+
"STRING_TOO_LONG" => StringTooLong,
|
364
|
+
"TABSET_LIMIT_EXCEEDED" => TabsetLimitExceeded,
|
365
|
+
"TEMPLATE_NOT_ACTIVE" => TemplateNotActive,
|
366
|
+
"TERRITORY_REALIGN_IN_PROGRESS" => TerritoryRealignInProgress,
|
367
|
+
"TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET" => TextDataOutsideSupportedCharset,
|
368
|
+
"TOO_MANY_APEX_REQUESTS" => TooManyApexRequests,
|
369
|
+
"TOO_MANY_ENUM_VALUE" => TooManyEnumValue,
|
370
|
+
"TRANSFER_REQUIRES_READ" => TransferRequiresRead,
|
371
|
+
"UNABLE_TO_LOCK_ROW" => UnableToLockRow,
|
372
|
+
"UNAVAILABLE_RECORDTYPE_EXCEPTION" => UnavailableRecordtypeException,
|
373
|
+
"UNDELETE_FAILED" => UndeleteFailed,
|
374
|
+
"UNKNOWN_EXCEPTION" => UnknownException,
|
375
|
+
"UNSPECIFIED_EMAIL_ADDRESS" => UnspecifiedEmailAddress,
|
376
|
+
"UNSUPPORTED_APEX_TRIGGER_OPERATION" => UnsupportedApexTriggerOperation,
|
377
|
+
"UNVERIFIED_SENDER_ADDRESS" => UnverifiedSenderAddress,
|
378
|
+
"WEBLINK_SIZE_LIMIT_EXCEEDED" => WeblinkSizeLimitExceeded,
|
379
|
+
"WEBLINK_URL_INVALID" => WeblinkUrlInvalid,
|
380
|
+
"WRONG_CONTROLLER_TYPE" => WrongControllerType
|
381
|
+
}.freeze
|
382
|
+
|
383
|
+
def self.get_exception_class(error_code)
|
384
|
+
ERROR_EXCEPTION_CLASSES.fetch(error_code) do |_|
|
385
|
+
warn "[restforce] An unrecognised error code, `#{error_code}` has been " \
|
386
|
+
"received from Salesforce. Instead of raising an error-specific exception, " \
|
387
|
+
"we'll raise a generic `ResponseError`. Please report this missing error code" \
|
388
|
+
" on GitHub at <#{GITHUB_ISSUE_URL}>."
|
389
|
+
|
390
|
+
# If we've received an unexpected error where we don't have a specific
|
391
|
+
# class defined, we can return a generic ResponseError instead
|
392
|
+
ResponseError
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
def self.const_missing(constant_name)
|
397
|
+
warn "[restforce] You're referring to a Restforce error that isn't defined, " \
|
398
|
+
"`#{name}::#{constant_name}` (for example by trying to `rescue` it). This might " \
|
399
|
+
"be our fault - we've recently made some changes to how errors are defined. If " \
|
400
|
+
"you're sure that this is a valid Salesforce error, then please create an " \
|
401
|
+
"issue on GitHub at <#{GITHUB_ISSUE_URL}>."
|
402
|
+
|
403
|
+
super(constant_name)
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|