ErrorUtil
Throw when a WSProxy result indicates failure so try/catch can handle SOAP-level errors. Deprecated in newer Core versions.
Deprecated / version-locked. Runtime testing shows ErrorUtil is provided only by Platform.Load("Core", "1"). Under newer Core versions (1.1.1, 1.1.5) ErrorUtil is undefined and ErrorUtil.ThrowWSProxyError() throws a ReferenceError. Prefer the result.Status check shown below, which works on every Core version.
WSProxy methods return a result object with a Status field instead of throwing on many SOAP failures. Historically ErrorUtil.ThrowWSProxyError(result) inspected that status and threw when the call failed, so you could use ordinary try / catch flow.
Recommended replacement (works on any Core version)
Check result.Status yourself and throw a standard Error:
var api = new Script.Util.WSProxy();
var customerKey = "00000000-0000-0000-0000-000000000001";
try {
var result = api.retrieve(
"DataExtensionObject[" + customerKey + "]",
["FirstName", "LastName", "EmailAddress"]
);
if (String(result.Status).indexOf("Error") === 0) {
throw new Error(String(result.Status));
}
// success path — use result.Results
} catch (ex) {
Write(String(ex));
}
Legacy: ErrorUtil.ThrowWSProxyError
ErrorUtil.ThrowWSProxyError(result);
| Parameter | Type | Required | Description |
|---|---|---|---|
result |
object | Yes | Any WSProxy return value (retrieve, performItem, createItem, etc.). Minimum shape includes Status, RequestID, and Results. |
Returns nothing when Status indicates success; throws when status indicates an error. Only available under Platform.Load("Core", "1"). When it throws on a real WSProxy error, the thrown value is a plain string (e.g. "Error: Data extension does not exist: …"), not an Error object — read it with String(ex); ex.message and ex.description are undefined.