F

error

Shows an error toast with an X icon, titled "Something went wrong" in the user's language, with the error's own message as its text, and logs the error.

function error(cause: unknown): ToastHandle

Shows an error toast with an X icon, titled "Something went wrong" in the user's language, with the error's own message as its text, and logs the error.

Parameters

NameTypeDescription
causeunknown

What was thrown or rejected: an Error, a string or anything else.

Returns

ToastHandle

A ToastHandle for controlling the shown toast.

function error<K extends keyof Messages>(key: K, ...args: MessageArgs<K, [error: unknown, options?: ToastShorthandOptions]>): ToastHandle

Shows an error toast titled by a message key, with the error's message as its text, and logs the error.

Parameters

NameTypeDescription
keyK

The title's message key.

...argsMessageArgs<K, [error: unknown, options?: ToastShorthandOptions]>

The key's placeholder values when it has placeholders, then the error, then optional icon, duration and id.

Returns

ToastHandle

A ToastHandle for controlling the shown toast.