Skip to content

Unable to parse file diffs for a PR containing a submodule update #115

@QuietMisdreavus

Description

@QuietMisdreavus

The following sample:

extern crate hubcaps;
extern crate tokio_core;

use tokio_core::reactor::Core;
use hubcaps::{Credentials, Github};

static TOKEN: &'static str = include_str!("github_token");

fn main() {
    let mut core = Core::new().unwrap();
    let client = Github::new(
        "hubcaps-test",
        Some(Credentials::Token(TOKEN.trim().to_string())),
        &core.handle());

    let resp = core.run(client.repo("rust-lang", "rust")
                              .pulls()
                              .get(49536)
                              .files()).unwrap();

    for diff in resp {
        println!("{:#?}", diff);
    }
}

...hits the unwrap in the middle, because submodule updates appear in the files listing, but are missing some information:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Codec(ErrorImpl { code: Message("invalid type: null, expected a string"), line: 1, column: 152 }), State { next_error: None, backtrace: None })', libcore/result.rs:945:5

I'm not sure how to get the plain JSON for the response, but hopefully the information in the snippet is enough to get to it.

This was with hubcaps 0.4.5 from crates.io.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions