Error Types
Which JavaScript error constructors exist in the SFMC engine — the seven legacy Error subtypes (Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError) are present, while the ES2021+ AggregateError, SuppressedError, and the non-standard InternalError are missing.
The SFMC server-side JavaScript engine (Jint, an ES3/ES5-era dialect) provides the seven legacy Error subtype constructors but none of the newer aggregate/suppressed error types. This page catalogs each constructor’s runtime status; for the base Error constructor’s full parameter and message-shape details, see the dedicated Error() page.
Status legend
| Icon | Meaning |
|---|---|
| ✅ Present | Constructor exists and produces a throwable error object |
| ❌ Missing | Not available (typeof is "undefined"; new throws Unknown type) |
Members
| Member | ES | Status | Notes |
|---|---|---|---|
Error() |
ES3 | ✅ Present | Base constructor — see its own page |
EvalError() |
ES3 | ✅ Present | Same shape as Error |
RangeError() |
ES3 | ✅ Present | Same shape as Error |
ReferenceError() |
ES3 | ✅ Present | Same shape as Error |
SyntaxError() |
ES3 | ✅ Present | Same shape as Error |
TypeError() |
ES3 | ✅ Present | Same shape as Error |
URIError() |
ES3 | ✅ Present | Same shape as Error |
AggregateError() |
ES2021 | ❌ Missing | typeof AggregateError === "undefined" |
SuppressedError() |
ES2026 | ❌ Missing | typeof SuppressedError === "undefined" |
InternalError() |
Non-standard | ❌ Missing | Firefox-only; typeof InternalError === "undefined" |
Shared behaviour of the present subtypes
All seven present constructors (Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError) behave identically to each other, and identically to the base Error constructor:
new SubType("msg")andSubType("msg")(withoutnew) both return anobject..namecorrectly reflects the subtype (e.g."TypeError","RangeError")..messagereads backundefined— the constructor argument is lost. Recover it withString(err)or("" + err);err.toString()returns"<name>: undefined"..descriptionisundefined.Stringify(err)returns{}(empty) for a JS-constructed subtype.
In standard JavaScript a caught error is an instance of its constructor and of Error, but in the SFMC (Jint) engine instanceof returns false for both — e.g. caught instanceof RangeError and caught instanceof Error are both false even when the caught value was created with new RangeError(...). Detect the type via err.name instead of instanceof.
In standard JavaScript new TypeError("msg").message returns "msg", but in the SFMC engine every JS-constructed error subtype reports .message as undefined; the message is only recoverable via String(err) or ("" + err).
EvalError
(ES3) — ✅ Present. Constructible; shares the common subtype behaviour. .name is "EvalError".
var e = new EvalError("bad eval");
Write(e.name); // "EvalError"
Write(String(e)); // "bad eval" (e.message is undefined)
RangeError
(ES3) — ✅ Present. Constructible; .name is "RangeError".
var e = new RangeError("out of range");
Write(e.name); // "RangeError"
Write(String(e)); // "out of range"
ReferenceError
(ES3) — ✅ Present. Constructible; .name is "ReferenceError".
var e = new ReferenceError("missing var");
Write(e.name); // "ReferenceError"
SyntaxError
(ES3) — ✅ Present. Constructible; .name is "SyntaxError".
var e = new SyntaxError("bad token");
Write(e.name); // "SyntaxError"
TypeError
(ES3) — ✅ Present. Constructible; .name is "TypeError". The most useful subtype for guarding against wrong argument types in your own helpers.
function requireString(v) {
if (typeof v != "string") {
throw new TypeError("expected a string");
}
return v;
}
try {
requireString(42);
} catch (e) {
Write(e.name + ": " + String(e)); // "TypeError: expected a string"
}
URIError
(ES3) — ✅ Present. Constructible; .name is "URIError". Note that the URI functions themselves (decodeURI etc.) do not throw URIError on malformed input in this engine — see Global Functions.
var e = new URIError("bad uri");
Write(e.name); // "URIError"
Missing error types
The following newer or non-standard error constructors are not defined in the SFMC engine. Use the base Error constructor instead.
AggregateError
(ES2021) — ❌ Missing. AggregateError (used with Promise.any) is not defined — typeof AggregateError === "undefined" and new AggregateError(...) throws Unknown type: AggregateError. Since Promise itself is absent, there is no scenario that would produce one.
SuppressedError
(ES2026) — ❌ Missing. SuppressedError (paired with using / disposable resources) is not defined — typeof SuppressedError === "undefined".
InternalError
(Non-standard) — ❌ Missing. InternalError is a Firefox-only, non-standard error type and is not defined in the SFMC engine — typeof InternalError === "undefined".