SafeFragmentError#code (also a reject event’s detail.code, and RenderResult#error.code) is a stable string enum: switch on
it, not on .message. Message text may change between patch versions; codes will not, except via a major bump.
name is "SafeFragmentError". instanceof SafeFragmentError holds across the ESM and CJS builds (and across realms): the class
defines Symbol.hasInstance by duck-typing instead of the prototype chain.
SafeFragmentErrorCode has these 23 members. “Surfaces as” says where you meet each one: a reject event (and a rejected
render() result), a thrown error from a function, or the render() result only.
The source is not a string (never rendered as [object Object]).
INVALID_OPTION
reject, throw
An option has a value outside its allowed set (for example idPolicy: "none"), or one that is only valid in another configuration (id-policy="keep-in-shadow" without scope="shadow").
SOURCE_TOO_LARGE
reject, throw
The source exceeds maxInputLength, which bounds the sanitizer’s worst-case cost.