MForster / factorio-rust-tools

A Rust library to export prototype definitions from Factorio.
4 stars 1 forks source link

Stream mod download into a file #77

Closed Builditluc closed 1 year ago

Builditluc commented 1 year ago

Linked to #74

Builditluc commented 1 year ago

It seems there is an issue with ModPortalClient::get_mod_spec, so I cannot test this. Returned error:

Error:
    0: Error while talking to the API Server
    1: error decoding response body: missing field `changelog` at line 1 column 27
    2: missing field `changelog` at line 1 column 27

Location:
    crates/factorio-cli/src/commands/download_mod.rs:30
MForster commented 1 year ago

Thanks for the contribution! :-D

It seems there is an issue with ModPortalClient::get_mod_spec, so I cannot test this.

Hm. Not sure where this is coming from. The changelog is documented to not be optional. Can you dump the reponse JSON to see what's going on? Maybe the API changed or is documented incorrectly?

If the server does indeed return valid responses without a changelog, I think we should change the type to optional.

MForster commented 1 year ago

Ah, one more thing, can you please also add an entry to CHANGELOG.md?

MForster commented 1 year ago
Error:
  0: Error while talking to the API Server
  1: error decoding response body: missing field `changelog` at line 1 column 27
  2: missing field `changelog` at line 1 column 27

Looking into that a bit more, I suspect that this is just an unhandled 404 (see #79) . I think you've used "Krastorio 2" as an example before, bute the mod is actually called "Krastorio2", without a space. Could that be it?

Yes, the error handling needs improving...

Builditluc commented 1 year ago

bute the mod is actually called "Krastorio2",

yes, that was the issue, the mod now downloads correctly. Regarding error handling, I think it would be best to first implement some testing system