# isGlobalDataQueriesError

Indicates whether or not an error is an instance of GlobalDataQueriesError.

# Reference

const result = isGlobalDataQueriesError(error);

# Parameters

  • error: An Error instance.

# Returns

A boolean value indicating whether or not the error is an instance of GlobalDataQueriesError.

# Usage

# Handle within an error boundary

import { isGlobalDataQueriesError } from "@squide/firefly";
import { useLocation, useRouteError } from "react-router-dom";

export function ErrorBoundary() {
    const error = useRouteError() as Error;
    const location = useLocation();

    useEffect(() => {
        if (isGlobalDataQueriesError(error)) {
            // ...
        }
    }, [location.pathname, error]);

    return (
        <div>
            <h2>Unmanaged error</h2>
            <p>An unmanaged error occurred and the application is broken, try refreshing your browser.</p>
        </div>
    );
}

# Handle with a try/catch

import { isGlobalDataQueriesError } from "@squide/firefly";

try {
    // ...
} catch (error: unknown) {
    if (isGlobalDataQueriesError(error)) {
        // ...
    }
}

# GlobalDataQueriesError

  • message: The error message.
  • errors: An array of Error instances.