Skip to main content

isMalformedId()

function isMalformedId(error: unknown): boolean;

True when the API rejected an id as malformed: a 409 carrying error_code 217, which it sends both for a value that does not base58-decode to 16 bytes and for one whose version nibble is not 7. That is a bad reference rather than a conflict, so it usually deserves a different message from isConflict.

Parameters​

ParameterType
errorunknown

Returns​

boolean

Example​

if (isMalformedId(error)) throw new Error(`Not a valid Comms id: ${ref}`)