chore: extract handleError function (#1078)

This commit is contained in:
Jonas Plum authored and GitHub committed 2024-07-12 18:52:00 +00:00
1 parent a700791f43
commit 00b7ab585c
20 files changed
+46 -146

No files matched your search

+10
View File
@@ -1,3 +1,5 @@
import { toast } from '@/components/ui/toast'
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
@@ -12,3 +14,11 @@ export function human(bytes: number) {
? (bytes / 1024).toFixed(1) + ' KB'
: (bytes / 1048576).toFixed(1) + ' MB'
}
export function handleError(error: Error) {
toast({
title: error.name,
description: error.message,
variant: 'destructive'
})
}