{"record":{"id":"1113d5da9db7708c","repo":"tonhowtf/omniget","slug":"other-message","errorCode":null,"errorMessage":"other.message()","messagePattern":"other\\.message\\(\\)","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/lists/trakt.rs","lineNumber":342,"sourceCode":"                \"client_secret\": c.client_secret,\n            }))\n            .send()\n            .await?;\n        let status = r.status().as_u16();\n        match poll_state(status) {\n            Poll::Done => {\n                let v: Value = r.json().await?;\n                let username = save_token(&v)?;\n                report(&p, TOOL_ID, \"done\", 1, Some(1), None);\n                return Ok(ConnectResult {\n                    connected: true,\n                    username: username.clone(),\n                    message: format!(\"conectado como {}\", username),\n                });\n            }\n            Poll::SlowDown => interval += Duration::from_secs(dc.interval.max(1)),\n            Poll::Pending => {}\n            other => return Err(anyhow!(\"{}\", other.message())),\n        }\n    }\n}\n\nfn save_token(v: &Value) -> Result<String> {\n    let access = v\n        .get(\"access_token\")\n        .and_then(|x| x.as_str())\n        .unwrap_or_default()\n        .to_string();\n    if access.is_empty() {\n        return Err(anyhow!(\"o Trakt não devolveu o token\"));\n    }\n    let refresh = v\n        .get(\"refresh_token\")\n        .and_then(|x| x.as_str())\n        .unwrap_or_default()\n        .to_string();","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/lists/trakt.rs#L324-L360","documentation":"Generic catch-all in wait_for_token's polling loop: any Poll outcome other than Success/SlowDown/Pending/Expired (e.g. Poll::Denied) is converted to an anyhow error via its message(). Most commonly this is the user explicitly denying the authorization request on trakt.tv/activate.","triggerScenarios":"The device-token poll endpoint returns a terminal status that maps to an unhandled Poll variant — typically Deny when the user clicks 'deny' during activation.","commonSituations":"User denied the request at trakt.tv/activate; an unrecognized poll response maps to a new Poll variant the caller did not anticipate.","solutions":["Read the error message from Poll::other.message() to identify the exact outcome","If denied, restart the flow with device_code() and have the user approve this time","Ensure the user enters the code under the correct Trakt account","Update match arms if Trakt introduced new poll statuses"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match wait_for_token(&dc, progress).await {\n    Err(e) => {\n        let msg = e.to_string();\n        if msg.contains(\"negad\") || msg.contains(\"denied\") {\n            // explain denial and offer to restart device_code()\n        } else {\n            return Err(e);\n        }\n    }\n    Ok(res) => { /* connected */ }\n}","preventionTips":["Instruct users to click 'allow' (not 'deny') at trakt.tv/activate","Handle each Poll variant explicitly instead of relying on the catch-all","Log the unrecognized variant to catch new Trakt poll statuses"],"tags":["oauth","trakt","device-flow","authorization-denied"],"backgroundTag":"oauth-token-exchange-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}