diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-07-17 16:22:54 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-07-17 16:23:42 +0200 |
commit | 8a7897f28c63812afaabe26ae759dfdcec01f9e2 (patch) | |
tree | db0d3d3d6e01ee341a338d0416574b2941700e0a | |
parent | 296efd815041ba583d255220e985286d8c1d4ddb (diff) | |
download | ezau-8a7897f28c63812afaabe26ae759dfdcec01f9e2.tar.gz ezau-8a7897f28c63812afaabe26ae759dfdcec01f9e2.tar.bz2 ezau-8a7897f28c63812afaabe26ae759dfdcec01f9e2.zip |
turn HTTP status code to error
If we don't do this, we end up trying to decode the error page as the
expected JSON response, which usually ends up with a "missing permalink"
field, which doesn't tell us a lot.
This way, we get a proper 404/500 error.
-rw-r--r-- | src/main.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index ddf54d8..395a0b5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -222,6 +222,7 @@ fn upload_log(file: &Path) -> Result<String> { .query(&[("json", 1)]) .multipart(form) .send()? + .error_for_status()? .json()?; Ok(resp.permalink) } |