{"record":{"id":"6a99ad920b199790","repo":"siyuan-note/siyuan","slug":"conf-language-30-err-error","errorCode":null,"errorMessage":"Conf.Language(30) + \" \" + err.Error()","messagePattern":"Conf\\.Language\\(30\\) \\+ \" \" \\+ err\\.Error\\(\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/repository.go","lineNumber":3261,"sourceCode":"type Backup struct {\n\tSize    int64  `json:\"size\"`\n\tHSize   string `json:\"hSize\"`\n\tUpdated string `json:\"updated\"`\n\tSaveDir string `json:\"saveDir\"` // 本地备份数据存放目录路径\n}\n\ntype Sync struct {\n\tSize      int64  `json:\"size\"`\n\tHSize     string `json:\"hSize\"`\n\tUpdated   string `json:\"updated\"`\n\tCloudName string `json:\"cloudName\"` // 云端同步数据存放目录名\n\tSaveDir   string `json:\"saveDir\"`   // 本地同步数据存放目录路径\n}\n\nfunc GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize, hTrafficAPIGet, hTrafficAPIPut string, err error) {\n\tstat, err := getCloudSpace()\n\tif err != nil {\n\t\terr = errors.New(Conf.Language(30) + \" \" + err.Error())\n\t\treturn\n\t}\n\n\tsyncSize := stat.Sync.Size\n\tsyncUpdated := stat.Sync.Updated\n\ts = &Sync{\n\t\tSize:    syncSize,\n\t\tHSize:   \"-\",\n\t\tUpdated: syncUpdated,\n\t}\n\n\tbackupSize := stat.Backup.Size\n\tbackupUpdated := stat.Backup.Updated\n\tb = &Backup{\n\t\tSize:    backupSize,\n\t\tHSize:   \"-\",\n\t\tUpdated: backupUpdated,\n\t}","sourceCodeStart":3243,"sourceCodeEnd":3279,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/repository.go#L3243-L3279","documentation":"GetCloudSpace wraps getCloudSpace and prefixes any underlying failure with the localized string for i18n key 30 (\"Failed to obtain cloud info\"). The final error message is \"<localized prefix> <underlying error>\". The real cause is always in the appended err.Error() — typically network failure, auth expiry, or a cloud API error.","triggerScenarios":"POST /api/repo/getCloudSpace (opening the cloud storage dialog or checking cloud usage) when the request to the cloud service fails: network outage, expired/invalid session token, subscription issues, or cloud-side 5xx.","commonSituations":"Offline or behind a proxy/firewall blocking the cloud endpoint; session token expired after long idle; cloud service maintenance; DNS failures on restricted networks.","solutions":["Read the full error message after the prefix to identify the underlying cause.","Check network connectivity and proxy/firewall settings for the cloud endpoint.","Log out and back in at Settings - Account & Sync - Account to refresh the token.","Retry later if the cloud service is temporarily unavailable."],"exampleFix":"// before\nconst resp = await fetchPost('/api/repo/getCloudSpace', {});\n// after\nconst resp = await fetchPost('/api/repo/getCloudSpace', {});\nif (resp.code !== 0 && resp.msg.includes('Failed to obtain cloud info')) {\n  // inspect resp.msg tail for the underlying cause; check network, re-login\n  await fetchPost('/api/account/logout', {});\n  // prompt user to log in again\n}","handlingStrategy":"try-catch","validationCode":"if (!navigator.onLine) {\n  throw new Error('Cannot get cloud space while offline');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const resp = await fetchPost('/api/repo/getCloudSpace', {});\n} catch (e) {\n  // message = localized prefix + underlying cause; parse tail after 'Failed to obtain cloud info'\n  const cause = e.message.replace(/^.*?Failed to obtain cloud info\\s*/, '');\n  if (/network|timeout|dial/i.test(cause)) showNetworkHelp();\n  else if (/auth|token|login/i.test(cause)) promptRelogin();\n}","preventionTips":["Check connectivity before querying cloud space in scripts.","Re-authenticate after long idle periods to avoid expired-token failures.","Always inspect the appended underlying error, not just the localized prefix.","Handle cloud maintenance windows with retry/backoff."],"tags":["network","cloud","wrapped-error","sync"],"backgroundTag":"api-error-response","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}