Skip to content

Ignoring error in renderError #788

@wkerswell-gresham

Description

@wkerswell-gresham

Is there a way that I can ignore one of the error statuses and return the normal route? We return partial data with a 403 when the user is requesting GQL with something in the graph they cannot access. I would like the page to still render as though there was no HTTP error.

const RouteConfig = createFarceRouter({
        ...
        renderError: ({ error }) => {
            switch (error.status) {
                case 404:
                case 500:
                    return <HttpErrorPage errorCode={error.status} />;

                case 401:
                    throw new RedirectException('/login');

               case 403:
                    // Do normal route rendering

                default:
                    return null;
            }
        }
    });

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions