showFailureToast
function showFailureToast(
error: unknown,
options?: {
title?: string;
primaryAction?: Toast.ActionOptions;
}
): Promise<T>;
error
is the error to report.
With a few options:
options.title
is a string describing the action that failed. By default,"Something went wrong"
import { showHUD } from "@raycast/api";
import { runAppleScript, showFailureToast } from "@raycast/utils";
export default async function () {
try {
const res = await runAppleScript(
`
on run argv
return "hello, " & item 1 of argv & "."
end run
`,
["world"]
);
await showHUD(res);
} catch (error) {
showFailureToast(error, { title: "Could not run AppleScript" });
}
}
Last modified 8d ago