Skip to content

Documentation / js-sdk-core / createErrorFormatter

Function: createErrorFormatter()

createErrorFormatter(messageMap): (error) => string

Takes a message map and return an error formatter, that takes an error and returns the corresponding error message.

Valid errors are all those in the classes PrivyApiError and PrivyClientError. Any other error will be treated as an unknown error.

Parameters

messageMap: ErrorMessageMap

The partial map used to format error messages by their error code.

Returns

Function

Parameters

error: unknown

Returns

string