11use std:: marker:: MarkerTrait ;
22use std:: io:: { self , Read , Seek , Cursor , Write , SeekFrom } ;
3+ use std;
34
45use mime:: { Mime , TopLevel , SubLevel , Attr , Value } ;
56use oauth2;
@@ -8,6 +9,8 @@ use hyper::header::{ContentType, ContentLength, Headers};
89use hyper:: http:: LINE_ENDING ;
910use hyper:: method:: Method ;
1011
12+ use serde;
13+
1114/// Identifies the Hub. There is only one per library, this trait is supposed
1215/// to make intended use more explicit.
1316/// The hub allows to access all resource methods more easily.
@@ -90,6 +93,11 @@ pub trait Delegate {
9093 None
9194 }
9295
96+ /// Called whenever a server response could not be decoded from json.
97+ /// It's for informational purposes only, the caller will return with an error
98+ /// accordingly.
99+ fn response_json_decode_error ( & mut self , json_encoded_value : & str ) { }
100+
93101 /// Called whenever the http request returns with a non-success status code.
94102 /// This can involve authentication issues, or anything else that very much
95103 /// depends on the used API method.
@@ -134,6 +142,10 @@ pub enum Result<T = ()> {
134142 /// An additional, free form field clashed with one of the built-in optional ones
135143 FieldClash ( & ' static str ) ,
136144
145+ /// Shows that we failed to decode the server response.
146+ /// This can happen if the protocol changes in conjunction with strict json decoding.
147+ JsonDecodeError ( serde:: json:: Error ) ,
148+
137149 /// Indicates an HTTP repsonse with a non-success status code
138150 Failure ( hyper:: client:: Response ) ,
139151
0 commit comments