Add customer management
This commit is contained in:
16
internal_frontend/lib/ui/showError.ts
Normal file
16
internal_frontend/lib/ui/showError.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// lib/ui/showError.ts
|
||||
import {toast} from "sonner";
|
||||
|
||||
export function showError(error: unknown, fallback = "Ein unbekannter Fehler ist aufgetreten") {
|
||||
let message: string;
|
||||
|
||||
if (error instanceof Error) {
|
||||
message = error.message;
|
||||
} else if (typeof error === "string") {
|
||||
message = error;
|
||||
} else {
|
||||
message = fallback;
|
||||
}
|
||||
|
||||
toast.error(message);
|
||||
}
|
||||
Reference in New Issue
Block a user