mattsse / chromiumoxide

Chrome Devtools Protocol rust API
Apache License 2.0
712 stars 69 forks source link

Include invalid JSON in an error returned with command execution #209

Open ryo33 opened 4 months ago

ryo33 commented 4 months ago

Related: #167

In the main branch, users cannot get invalid JSON after getting an error with calling a function that executes a command, and it does not help to write fallback logic on receiving invalid responses from Chromium.

In my case, I had created a custom command just for getting serde_json::Value like the following.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CustomGetFullAxTree;

impl Command for CustomGetFullAxTree {
    type Response = Value;
}

impl Method for CustomGetFullAxTree {
    fn identifier(&self) -> chromiumoxide::types::MethodId {
        chromiumoxide::types::MethodId::Borrowed("Accessibility.getFullAXTree")
    }
}