This commit is contained in:
2025-03-02 17:15:58 +00:00
commit e4253e6de2
26 changed files with 1806 additions and 0 deletions

3
src/utils/parseError.ts Normal file
View File

@@ -0,0 +1,3 @@
export function parseError(error: unknown): Error {
return error instanceof Error ? error : new Error(JSON.stringify(error));
}

View File

@@ -0,0 +1,13 @@
import { type Context, useContext } from "solid-js";
export const useRequiredContext = <T>(context: Context<T | undefined>): T => {
const getContext = useContext(context);
if (getContext === undefined) {
throw new Error(
`${context.constructor.name} must be used within a provider instance`,
);
}
return getContext;
};