• Generates a help link URL based on error type. Maps error types to relevant USER_GUIDE sections. Returns a resolvable URL to documentation (GitHub or in-app).

    Parameters

    • errorType: ErrorType

      The error type to get help for.

    Returns null | string

    The full URL to the help section, or null if no help available.

    export function getHelpLinkForErrorType(errorType: ErrorType): string | null {
    const helpLinkConfig: HelpLinkConfig = {
    [ErrorType.VALIDATION]: "#handling-import-errors",
    [ErrorType.IMPORT]: "#handling-import-errors",
    [ErrorType.AUTH]: "#anilist-authentication",
    [ErrorType.NETWORK]: "#troubleshooting",
    [ErrorType.SERVER]: "#synchronizing-to-anilist",
    [ErrorType.STORAGE]: "#troubleshooting",
    [ErrorType.SYSTEM]: "#getting-help",
    [ErrorType.CLIENT]: "#getting-help",
    [ErrorType.UNKNOWN]: "#getting-help",
    };

    const anchor = helpLinkConfig[errorType];
    if (!anchor) return null;

    // Construct URL to USER_GUIDE documentation
    // In production, this points to the GitHub repository
    // Users can also access via in-app route if available
    const baseUrl =
    "https://github.com/RLAlpha49/KenmeiToAnilist/blob/master/docs/guides/USER_GUIDE.md";
    return `${baseUrl}${anchor}`;
    }