jackwener/OpenCLI · error
点赞失败: ${errorMessage}
Error message
点赞失败: ${errorMessage} What it means
This is the catch-all wrapper in the hupu like handler: any thrown value that is not already a CliError is converted to Error(`点赞失败: ${message}`), preserving the inner message. It exists so the command always fails with a readable Chinese-language top-level message.
Source
Thrown at clis/hupu/like.js:73
status: '⚠️ 已经点赞过了',
message: result.msg || ''
}];
}
else if (result.code === 0) {
return [{
status: '⚠️ 操作未执行',
message: result.msg || result.message || ''
}];
}
else {
throw new Error(`接口错误 code=${result.code}: ${result.msg || result.message}`);
}
}
catch (error) {
if (error instanceof CliError)
throw error;
const errorMessage = error instanceof Error ? error.message : String(error);
throw new Error(`点赞失败: ${errorMessage}`);
}
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Read the inner message after '点赞失败: ' to find the root cause
- If it wraps '接口错误 code=...', follow the code-specific fix (re-login for auth codes, backoff for rate limits)
- Retry after checking connectivity to hupu.com
- If the inner message is 'Cannot read properties of undefined', the API response schema likely changed — update response parsing in clis/hupu/like.js
Example fix
// before
await hupuLike(page, tid);
// after
try { await hupuLike(page, tid); }
catch (e) { console.error('like failed:', e.message.replace('点赞失败: ', '')); } Defensive patterns
Strategy: try-catch
Validate before calling
if (!page || page.isClosed?.()) throw new Error('page closed before like'); Try / catch
try {
await hupuLike(page, tid);
} catch (e) {
const inner = e.message.replace('点赞失败: ', '');
if (inner.startsWith('接口错误')) handleApiCode(inner);
else console.error('like transport failure:', inner);
} Prevention
- Unwrap the 点赞失败 prefix to reach the root cause before retrying
- Ensure the page is alive and on hupu.com before invoking like
- Handle JSON parse failures by checking response content-type
- Re-authenticate when the inner message indicates auth errors
When it happens
Trigger: Any non-CliError exception during the like flow — network failure during the API call, JSON parsing of an unexpected response body, a TypeError from accessing fields on an undefined result, or the non-200 code error from the sibling throw.
Common situations: Hupu API returning HTML or an empty body instead of JSON (anti-bot or 5xx); interrupted network; code changes causing undefined property access; underlying 接口错误 being re-wrapped with the 点赞失败 prefix.
Related errors
- 获取视频信息失败: ${err?.message || err}
- 接口错误 code=${result.code}: ${result.msg || result.message}
- 回复失败: ${errorMessage}
- API_ERROR
- API_ERROR
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6a81acf8bdc346b4.
Report an issue: GitHub.