- 删除 requirements.txt,pyproject.toml 为唯一依赖源(含 requests[socks] extra) - core/geetest 下 5 处 print() 替换为 loguru logger.debug() - api/modules.ts 新增 13 个响应接口,消除所有 api.xxx<any, any> - 新建 utils/error.ts 提供 getErrorMessage(e: unknown) 安全取消息 - 11 个页面组件 catch (e: any) 改为 catch (e: unknown) - useState<any[]>、columns: any[]、render 参数全部类型化 - TypeScript 类型检查零错误通过
7 lines
229 B
TypeScript
7 lines
229 B
TypeScript
/** 从 unknown 类型的 catch 错误中安全提取 message */
|
|
export function getErrorMessage(e: unknown): string {
|
|
if (e instanceof Error) return e.message;
|
|
if (typeof e === 'string') return e;
|
|
return '未知错误';
|
|
}
|