@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
42 lines (39 loc) • 1.15 kB
JavaScript
import { headersBoundary } from './headers.mjs';
import { errorBoundary } from './error.mjs';
/**
* A collection of functions that handle the necessary code for error boundaries in routes using authenticate.admin.
*/
const boundary = {
/**
* A function that handles errors or thrown responses.
*
* @example
* <caption>Catching errors in a route</caption>
* ```ts
* // /app/routes/admin/widgets.ts
* import { boundary } from "@shopify/shopify-app-remix/server";
*
* export function ErrorBoundary() {
* return boundary.error(useRouteError());
* }
* ```
*/
error: errorBoundary,
/**
* A function that sets the appropriate document response headers.
*
* @example
* <caption>Catching errors in a route</caption>
* ```ts
* // /app/routes/admin/widgets.ts
* import { boundary } from "@shopify/shopify-app-remix/server";
*
* export const headers = (headersArgs) => {
* return boundary.headers(headersArgs);
* };
* ```
*/
headers: headersBoundary,
};
export { boundary };
//# sourceMappingURL=index.mjs.map