DIYgod/RSSHub · error · Error

Error fetching academic information: ${error}

Error message

Error fetching academic information: ${error}

What it means

Catch-all wrapping the entire /xbmu/academic handler. Any failure — initial list fetch, per-item detail fetch, cheerio parsing, cache write — is re-thrown with an 'Error fetching academic information:' prefix and the original attached via { cause: error }.

Source

Thrown at lib/routes/xbmu/academic.ts:73

                            description: content,
                            category: ['university'],
                            guid: item.link,
                            id: item.link,
                            image: 'http://210.26.0.114:9090/mdxg/img/weex/default_img.jpg',
                            content,
                            updated: item.date,
                            language: 'zh-CN',
                        };
                    })
                )
            )) as DataItem[],
            allowEmpty: true,
            language: 'zh-CN',
            feedLink: 'https://rsshub.app/xbmu/academic',
            id: 'https://rsshub.app/xbmu/academic',
        };
    } catch (error) {
        throw new Error(`Error fetching academic information: ${error}`, { cause: error });
    }
};

export const route: Route = {
    path: '/academic',
    name: '学术信息',
    maintainers: ['PrinOrange'],
    handler,
    categories: ['university'],
    features: {
        requireConfig: false,
        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    example: '/xbmu/academic',

View on GitHub (pinned to bed535e087)

Solutions

  1. Inspect error.cause for the real failure (HTTP status, parse error).
  2. Verify https://www.xbmu.edu.cn/xwzx/xsxx.htm loads in a browser from the RSSHub host's network.
  3. If the site moved/changed selectors, report to the maintainer (PrinOrange) — the CSS selector at academic.ts:17 may need updating.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight the source URL before the full scrape
try {
    const r = await got.head('https://www.xbmu.edu.cn/xwzx/xsxx.htm', { timeout: 5000 });
    if (r.statusCode >= 400) throw new Error(`xbmu returned ${r.statusCode}`);
} catch (e) {
    throw new Error('xbmu academic source unreachable');
}

Type guard

function isXbmuAcademicError(e: unknown): boolean {
    return e instanceof Error && /Error fetching academic information/i.test(e.message);
}

Try / catch

try {
    return await xbmuAcademicHandler();
} catch (e) {
    const root = isXbmuAcademicError(e) ? (e.cause ?? e) : e;
    if (root instanceof Error && /ENOTFOUND|ETIMEDOUT|getaddrinfo/i.test(root.message)) {
        await scheduleRetry();   // transient campus-network issue
    }
    throw e;
}

Prevention

When it happens

Trigger: got(BASE_URL) or got(item.link) raises (network/HTTP error), or cheerio/load throws on malformed HTML, caught at academic.ts:72-74.

Common situations: xbmu.edu.cn is down or returning non-HTML (a redirect/login page), a detail link 404s, or the campus site changed its list markup.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/af283ea4d633520d. Report an issue: GitHub.