@adobe/acc-js-sdk 1.1.4 → 1.1.7

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.
package/src/campaign.js CHANGED
@@ -10,10 +10,10 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
  (function() {
13
- "use strict";
13
+ "use strict";
14
14
 
15
15
  const { Util } = require("./util.js");
16
-
16
+
17
17
  /**
18
18
  * @namespace Campaign
19
19
  */
@@ -38,7 +38,8 @@ const { Util } = require("./util.js");
38
38
  static NOT_LOGGED_IN(call, details) { return new CampaignException( call, 400, 16384, `SDK-000010 Cannot call API because client is not logged in`, details); }
39
39
  static DECRYPT_ERROR(details) { return new CampaignException(undefined, 400, 16384, `SDK-000011 "Cannot decrypt password: password marker is missing`, details); }
40
40
  static SESSION_EXPIRED() { return new CampaignException(undefined, 401, 16384, `SDK-000012 "Session has expired or is invalid. Please reconnect.`); }
41
-
41
+ static FILE_UPLOAD_FAILED(name, details) { return new CampaignException(undefined, 500, 16384, `SDK-000013 "Failed to upload file ${name}`, details); }
42
+
42
43
 
43
44
  /**
44
45
  * Returns a short description of the exception
@@ -49,18 +50,18 @@ const { Util } = require("./util.js");
49
50
  }
50
51
 
51
52
  /**
52
- * Represents a Campaign exception, i.e. any kind of error that can happen when calling Campaign APIs,
53
+ * Represents a Campaign exception, i.e. any kind of error that can happen when calling Campaign APIs,
53
54
  * ranging from HTTP errors, XML serialization errors, SOAP errors, authentication errors, etc.
54
- *
55
+ *
55
56
  * Members of this object are trimmed, and all session tokens, security tokens, passwords, etc. are replaced by "***"
56
- *
57
+ *
57
58
  * @param {SoapMethodCall|request} call the call that triggered the error. It can be a SoapMethodCall object, a HTTP request object, or even be undefined if the exception is generated outside of the context of a call
58
59
  * @param {number} statusCode the HTTP status code (200, 500, etc.)
59
60
  * @param {string} faultCode the fault code, i.e. an error code
60
61
  * @param {string} faultString a short description of the error
61
62
  * @param {string} detail a more detailed description of the error
62
63
  * @param {Error|string} cause an optional error object representing the cause of the exception
63
- */
64
+ */
64
65
  constructor(call, statusCode, faultCode, faultString, detail, cause) {
65
66
 
66
67
  // Provides a shorter and more friendly description of the call and method name
@@ -80,7 +81,7 @@ const { Util } = require("./util.js");
80
81
  };
81
82
  methodName = `${call.urn}#${call.methodName}`; // Example: "xtk:session#Logon"
82
83
  }
83
- else {
84
+ else {
84
85
  // HTTP call
85
86
  // Extract the path of the request URL if there's one
86
87
  // If it's a relative URL, use the URL itself
@@ -140,48 +141,48 @@ const { Util } = require("./util.js");
140
141
  faultString = faultString.trim();
141
142
  }
142
143
 
143
- /**
144
+ /**
144
145
  * The type of exception, always "CampaignException"
145
146
  * @type {string}
146
147
  */
147
148
  this.name = "CampaignException";
148
- /**
149
+ /**
149
150
  * A human friendly message describing the error
150
151
  * @type {string}
151
152
  */
152
153
  this.message = message;
153
- /**
154
- * The HTTP status code corresponding to the error
154
+ /**
155
+ * The HTTP status code corresponding to the error
155
156
  * @type {number}
156
157
  */
157
158
  this.statusCode = statusCode;
158
- /**
159
- * An object describing the call (SOAP or HTTP) which caused the exception. Can be null
159
+ /**
160
+ * An object describing the call (SOAP or HTTP) which caused the exception. Can be null
160
161
  * @type {string}
161
162
  */
162
163
  this.methodCall = methodCall;
163
- /**
164
- * A Campaign-specific error code, such as XSV-350013. May not be set if the exception did not come from a SOAP call
164
+ /**
165
+ * A Campaign-specific error code, such as XSV-350013. May not be set if the exception did not come from a SOAP call
165
166
  * @type {string}
166
167
  */
167
168
  this.errorCode = errorCode;
168
- /**
169
- * An error code
169
+ /**
170
+ * An error code
170
171
  * @type {string}
171
172
  */
172
173
  this.faultCode = faultCode;
173
- /**
174
- * A short description of the error
174
+ /**
175
+ * A short description of the error
175
176
  * @type {string}
176
177
  */
177
178
  this.faultString = faultString;
178
- /**
179
- * A detailed description of the error
179
+ /**
180
+ * A detailed description of the error
180
181
  * @type {string}
181
182
  */
182
183
  this.detail = detail;
183
- /**
184
- * The cause of the error, such as the root cause exception
184
+ /**
185
+ * The cause of the error, such as the root cause exception
185
186
  */
186
187
  this.cause = cause;
187
188
 
@@ -199,7 +200,7 @@ const { Util } = require("./util.js");
199
200
 
200
201
  /**
201
202
  * Creates a CampaignException for a SOAP call and from a root exception
202
- *
203
+ *
203
204
  * @private
204
205
  * @param {SoapMethodCall} call the SOAP call
205
206
  * @param {*} err the exception causing the SOAP call.
@@ -210,7 +211,7 @@ function makeCampaignException(call, err) {
210
211
  // It's already a CampaignException
211
212
  if (err instanceof CampaignException)
212
213
  return err;
213
-
214
+
214
215
  // Wraps DOM exceptions which can occur when dealing with malformed XML
215
216
  const ctor = Object.getPrototypeOf(err).constructor;
216
217
  if (ctor && ctor.name == "DOMException") {
@@ -244,9 +245,9 @@ exports.CampaignException = CampaignException;
244
245
  exports.makeCampaignException = makeCampaignException;
245
246
 
246
247
  /**********************************************************************************
247
- *
248
+ *
248
249
  * Business constants and helpers
249
- *
250
+ *
250
251
  *********************************************************************************/
251
252
 
252
253
  // Ignore constant definitions from coverage