mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-05 07:10:13 +00:00
added way to save content and vectorize them. also refactored code and added a bypass to browser rendering
This commit is contained in:
parent
84455ad5d5
commit
4daee14a82
31 changed files with 479 additions and 106 deletions
|
|
@ -1,25 +0,0 @@
|
|||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
import { toast } from "sonner";
|
||||
import { z } from "zod";
|
||||
|
||||
export function getErrorMessage(err: unknown) {
|
||||
const unknownError = "Something went wrong, please try again later.";
|
||||
|
||||
if (err instanceof z.ZodError) {
|
||||
const errors = err.issues.map((issue) => {
|
||||
return issue.message;
|
||||
});
|
||||
return errors.join("\n");
|
||||
} else if (err instanceof Error) {
|
||||
return err.message;
|
||||
} else if (isRedirectError(err)) {
|
||||
throw err;
|
||||
} else {
|
||||
return unknownError;
|
||||
}
|
||||
}
|
||||
|
||||
export function showErrorToast(err: unknown) {
|
||||
const errorMessage = getErrorMessage(err);
|
||||
return toast.error(errorMessage);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue