From 2ee218be5503a31a1f69ec435de97ca04fb235fb Mon Sep 17 00:00:00 2001 From: Mark Catley Date: Thu, 27 Jun 2019 11:10:48 +1200 Subject: [PATCH] Adding error logging to the Device Flow. --- src/device.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/device.rs b/src/device.rs index 2beaaea..e830e7d 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1,9 +1,10 @@ use std::iter::{FromIterator, IntoIterator}; use std::time::Duration; +use ::log::{log, error}; use chrono::{self, Utc}; -use futures::stream::Stream; use futures::{future, prelude::*}; +use futures::stream::Stream; use http; use hyper; use hyper::header; @@ -150,11 +151,13 @@ where | Err(e @ PollError::Expired(_)) => { Box::new(Err(RequestError::Poll(e)).into_future()) } - Err(_) if i < maxn => { + Err(ref e) if i < maxn => { + error!("Unknown error from poll token api: {}", e); Box::new(Ok(future::Loop::Continue(i + 1)).into_future()) } // Too many attempts. Ok(None) | Err(_) => { + error!("Too many poll attempts"); Box::new(Err(RequestError::Poll(PollError::TimedOut)).into_future()) } })