Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes if GitHub API content is unknown: 'Cannot deserialize GitHub API content: unknown variant' #22

Closed
nicokosi opened this issue Aug 3, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@nicokosi
Copy link
Owner

nicokosi commented Aug 3, 2018

The GitHub API events is used and its enumerations are encoded (issue types, statuses etc.). If enumerations are unknown, pullpito fails.
Example:

cargo run -- --repository nicokosi/pullpito
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target/debug/pullpito --repository nicokosi/pullpito`
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: StringError("Cannot deserialize GitHub API content: unknown variant `added`, expected one of `closed`, `created`, `edited`, `opened`, `started` at line 1 column 11304") }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Either code all known enumerations, or find a way to ignore unknown ones.

@nicokosi nicokosi added the bug Something isn't working label Aug 3, 2018
@nicokosi
Copy link
Owner Author

nicokosi commented Aug 3, 2018

I opened this serde_json issue: serde-rs/json#470

@nicokosi
Copy link
Owner Author

Closed issue serde-rs/json#470 and opened issue serde-rs/serde#1353.

nicokosi added a commit that referenced this issue Aug 12, 2018
nicokosi added a commit that referenced this issue Aug 12, 2018
Only keep used GitHub enums and set a default value for unused ones.

Use tip from documentation:
https://serde.rs/attr-default.html

This tip has been given by @dtolnay in this issue:
serde-rs/serde#1353
@nicokosi
Copy link
Owner Author

Fixed in 0abb031.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant