{"record":{"id":"6a81acf8bdc346b4","repo":"jackwener/OpenCLI","slug":"errormessage","errorCode":null,"errorMessage":"点赞失败: ${errorMessage}","messagePattern":"点赞失败: \\$\\{errorMessage\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clis/hupu/like.js","lineNumber":73,"sourceCode":"                        status: '⚠️ 已经点赞过了',\n                        message: result.msg || ''\n                    }];\n            }\n            else if (result.code === 0) {\n                return [{\n                        status: '⚠️ 操作未执行',\n                        message: result.msg || result.message || ''\n                    }];\n            }\n            else {\n                throw new Error(`接口错误 code=${result.code}: ${result.msg || result.message}`);\n            }\n        }\n        catch (error) {\n            if (error instanceof CliError)\n                throw error;\n            const errorMessage = error instanceof Error ? error.message : String(error);\n            throw new Error(`点赞失败: ${errorMessage}`);\n        }\n    },\n});\n","sourceCodeStart":55,"sourceCodeEnd":77,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/hupu/like.js#L55-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait hupuLike(page, tid);\n// after\ntry { await hupuLike(page, tid); }\ncatch (e) { console.error('like failed:', e.message.replace('点赞失败: ', '')); }","handlingStrategy":"try-catch","validationCode":"if (!page || page.isClosed?.()) throw new Error('page closed before like');","typeGuard":null,"tryCatchPattern":"try {\n  await hupuLike(page, tid);\n} catch (e) {\n  const inner = e.message.replace('点赞失败: ', '');\n  if (inner.startsWith('接口错误')) handleApiCode(inner);\n  else console.error('like transport failure:', inner);\n}","preventionTips":["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"],"tags":["error-wrapping","hupu","like","api"],"backgroundTag":"wrapped-error-message","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}