Drevoed / narwhalol

Idiomatic Rust League of Legends DDragon and API wrapper
MIT License
8 stars 0 forks source link

Summoner not found returns wrong error #12

Open BlaCoiso opened 3 years ago

BlaCoiso commented 3 years ago

From tests output:

---- tests::ensure_different_runtimes_work_with_lib stdout ----
Getting summoner with name: Vetro
thread 'tests::ensure_different_runtimes_work_with_lib' panicked at 'called `Result::unwrap()` on an `Err` value: Error("missing field `profileIconId`", line: 1, column: 78)', src\api.rs:235:74

Response from Riot API (status code 404):

{
    "status": {
        "message": "Data not found - summoner not found",
        "status_code": 404
    }
}

Making the request to the Riot API returns 404, which should be handled and return a different error rather than a parsing fail

Drevoed commented 3 years ago

Hello, yes, this is probably because user changed his summoner name. Will change tests to use internal id, thanks for the issue!