{"record":{"id":"e82949e6f7b90a3a","repo":"tonhowtf/omniget","slug":"erro-da-api-mod","errorCode":null,"errorMessage":"Erro da API: {}","messagePattern":"Erro da API: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bluesky/mod.rs","lineNumber":148,"sourceCode":"        let url = format!(\n            \"{}?depth=0&parentHeight=0&uri={}\",\n            API_BASE,\n            urlencoding::encode(&uri)\n        );\n\n        let response = self.client.get(&url).send().await?;\n\n        if !response.status().is_success() {\n            return Err(anyhow!(\"Bluesky API retornou HTTP {}\", response.status()));\n        }\n\n        let json: serde_json::Value = response.json().await?;\n\n        if let Some(error) = json.get(\"error\").and_then(|e| e.as_str()) {\n            return match error {\n                \"NotFound\" | \"InternalServerError\" => Err(anyhow!(\"Post not available\")),\n                \"InvalidRequest\" => Err(anyhow!(\"Unsupported link\")),\n                _ => Err(anyhow!(\"Erro da API: {}\", error)),\n            };\n        }\n\n        Ok(json)\n    }\n}\n\nenum BlueskyMedia {\n    Video { hls_url: String },\n    Images { urls: Vec<String> },\n    Gif { url: String },\n}\n\nfn extract_media(embed: &serde_json::Value) -> Option<BlueskyMedia> {\n    let embed_type = embed.get(\"$type\")?.as_str()?;\n\n    match embed_type {\n        \"app.bsky.embed.video#view\" => {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bluesky/mod.rs#L130-L166","documentation":"In `fetch_post` (src-tauri/src/platforms/bluesky/mod.rs:148), the AppView returned a structured error string not covered by the known cases (NotFound, InternalServerError, InvalidRequest), producing \"Erro da API: {error}\". This is the catch-all for any other AppView error name, present or future.","triggerScenarios":"The response JSON contains an `error` field whose value is an unrecognized error name — e.g. AuthRequired, RateLimitExceeded, or newly introduced AppView error codes.","commonSituations":"Bluesky adding new error types the local mapping doesn't know; authentication-gated content returning AuthRequired; temporary API changes during platform migrations.","solutions":["Read the error name in the message and check the AT Protocol AppView error documentation for its meaning.","Add explicit handling for recurring new error names (e.g. rate limits → backoff).","Check whether authentication is required for the content and configure an account if supported.","Retry later if the error suggests a transient or server-side condition."],"exampleFix":"// before\n_ => Err(anyhow!(\"Erro da API: {}\", error)),\n// after\n\"RateLimitExceeded\" => Err(anyhow!(\"Bluesky rate limit exceeded; retry later\")),\n_ => Err(anyhow!(\"Erro da API: {}\", error)),","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match fetch_post(&user, &post_id).await {\n    Ok(json) => json,\n    Err(e) if e.to_string().starts_with(\"Erro da API:\") => {\n        let code = e.to_string().splitn(2, \": \").nth(1).unwrap_or(\"\");\n        anyhow::bail!(\"Bluesky AppView returned unknown error '{code}'; check AT Protocol docs or retry later\")\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the error-name mapping in sync with current AT Protocol error codes.","Add AuthRequired handling if private content matters to you.","Never swallow unknown error names — surface them verbatim for diagnosis."],"tags":["rust","bluesky","api-error","unhandled-case"],"backgroundTag":"api-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}