Structured CE.SDK error. Extends the standard JS Error so existing
try { ... } catch (error) { console.log(error.message); } flows keep working — message is
the engine’s rendered English string. The structured fields (code, category, hint, args,
docsUrl, silent) let consumers branch on stable identifiers instead of matching on
the message string and surface customer-facing copy + doc links.
Every engine error carries a stable, non-empty catalog code. Branch on the codes you handle
and keep a default fallback to the message for the rest — the catalog is append-only, so
existing codes never change meaning but new codes ship over time.
The error’s name embeds the code ("EngineError [SCENE.NOT_VALID]"), so stack traces
and String(error) identify the failure without inspecting fields. Don’t match on name —
narrow with isEngineError (or instanceof) and branch on code.
When logging to an external service, note that JSON.stringify(error) serializes the
structured own fields but — as with any Error — omits message and stack. Extract the
payload explicitly, e.g.
{ code: error.code, message: error.message, hint: error.hint, args: error.args }.
Example#
try { engine.block.setTextFontSize(blockId, 0);} catch (error) { if (error instanceof EngineError && error.code === 'BLOCK.TEXT_INVALID_FONT_SIZE') { toast.show(t(`error.${camelCase(error.code)}`, error.args)); if (error.docsUrl) window.open(error.docsUrl); } else { throw error; }}Extends#
Error
Constructors#
Constructor#
| Parameter | Type |
| —— | —— |
| message? | string |
message? | string |Returns#
EngineError
Inherited from#
Error.constructorConstructor#
| Parameter | Type |
| —— | —— |
| message? | string |
| options? | ErrorOptions |
message? | string |
| options? | ErrorOptions |Returns#
EngineError
Inherited from#
Error.constructorProperties#
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
code |
readonly |
string |
Stable catalog id (e.g. "SCENE.NOT_VALID"). Non-empty for every engine error. |
- |
category |
readonly |
string |
Category prefix of code (e.g. "SCENE"). |
- |
hint |
readonly |
string |
English “what to do next” hint, already interpolated with args. Empty when the catalog entry does not declare a hint. | - |
args |
readonly |
Record<string, EngineErrorArg> |
Typed template arguments. Numbers stay numbers, booleans stay booleans, strings stay strings — pass this map straight into i18next/Intl.NumberFormat/etc. |
- |
silent |
readonly |
boolean |
Whether the catalog marks this error as silent (expected platform limitation that should not be logged). Consumers may still surface it programmatically. | - |
docsUrl |
readonly |
string |
Fully-qualified docs URL on img.ly, e.g. https://img.ly/docs/cesdk/js/user-interface/font-size-d194d1/. null when the catalog entry links no docs page. |
- |
cause? |
public |
unknown |
- | Error.cause |
name |
public |
string |
- | Error.name |
message |
public |
string |
- | Error.message |
stack? |
public |
string |
- | Error.stack |