import { GetServerSidePropsResult } from 'next'; import { HeadlessGetServerSidePropsContext, HeadlessGetStaticPropsPropsContext } from '../types'; /** * Extracts the path name out of the Next.js resolvedUrl * * @param resolvedUrl The full resolved URL * * @returns */ export declare function getPathName(resolvedUrl: string): string; /** * The `handleError` function is responsible for handling errors that occur during * data fetching in `getServerSideProps` or `getStaticProps`. * * It also handles redirects if `redirectStrategy` is set to `404` in `headless.config.js` * * If `error` is of type {@link NotFoundError} it will redirect to the 404 page. Otherwise it will * return a server error (500) page * ## Usage * * ```ts * export async function getServerSideProps(context) { * try { * const usePostsHook = await fetchHookData(usePosts.fetcher(),context); * return addHookData([usePostsHook], {}); * } catch (e) { * return handleError(e, context); * } * } * ``` * * @param error The error object * @param ctx The Next.js context * @param rootRoute The root route (deprecated/unnecessary). This needs to be revisited * * @category Next.js Data Fetching Utilities */ export declare function handleError(error: Error, ctx: HeadlessGetServerSidePropsContext | HeadlessGetStaticPropsPropsContext, rootRoute?: string): Promise>;