mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-04 02:20:54 +01:00
Extend attempted error message parsing to also cover ErrorResponse
objects. Fixes errors in e.g. drive3 api not getting passed to delegate error handlers.
This commit is contained in:
committed by
Sebastian Thiel
parent
8e9ce08aa2
commit
6ed8df5f96
@@ -783,9 +783,15 @@ else {
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
|
||||
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
|
||||
let server_error = json::from_str::<ServerError>(&json_err)
|
||||
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
|
||||
.ok();
|
||||
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
json_server_error,
|
||||
server_error) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user