Skip to content
Typediscord-component-embedv1.1.0

ComponentEmbedErrorCode

Error codes for component embed issues. You can branch on them to handle different kinds of errors programmatically using the code property.

  • InvalidStructure: a wrong root, a component in the wrong place, a parent with the wrong number of children, an empty TextDisplay, text outside one, or a Vue VNode. From fromPayload, also JSON where a component or gallery item isn't an object, a type a component embed doesn't take, or a button that isn't a link button.

  • InvalidProp: a prop with the wrong type or value, like a spacing of 'medium' or a URL with a bad scheme. From fromPayload, also a key a component doesn't take, a bad id, or a list, content, media, or emoji with the wrong shape.

  • OverLimit: a length, count, or byte limit Discord sets.

  • UnsupportedComponent: a memo, lazy, forwardRef, context, class, or async component.

  • ReadFailed: a component or an iterator of yours threw while the package read the tree. The original error is on cause.

type ComponentEmbedErrorCode =
    | "InvalidStructure"
    | "InvalidProp"
    | "OverLimit"
    | "UnsupportedComponent"
    | "ReadFailed";