File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1+ use podcast_api:: Error ;
12use serde_json:: json;
23
34#[ tokio:: main]
@@ -17,7 +18,7 @@ async fn main() {
1718 . await
1819 {
1920 Ok ( response) => {
20- println ! ( "Successfully called \" typeahead \" endpoint ." ) ;
21+ println ! ( "Successfully called Listen Notes API ." ) ;
2122 if let Ok ( body) = response. json ( ) . await {
2223 println ! ( "Response Body:" ) ;
2324 println ! ( "{}" , body) ;
@@ -26,8 +27,16 @@ async fn main() {
2627 }
2728 }
2829 Err ( err) => {
29- println ! ( "Error calling \" typeahead\" endpoint:" ) ;
30- println ! ( "{}," , err) ;
30+ match err {
31+ Error :: NotFoundError => { println ! ( "Not Found: {}" , err) ; }
32+ Error :: AuthenticationError => { println ! ( "Authentication Issue: {}" , err) ; }
33+ Error :: RateLimitError => { println ! ( "Rate Limit: {}" , err) ; }
34+ Error :: InvalidRequestError => { println ! ( "Invalid Request: {}" , err) ; }
35+ Error :: ListenApiError => { println ! ( "API Error: {}" , err) ; }
36+ Error :: ApiConnectionError => { println ! ( "Connection Issue: {}" , err) ; }
37+ Error :: Reqwest ( err) => { println ! ( "Reqwest HTTP Client Error: {}" , err) ; }
38+ Error :: Json ( err) => { println ! ( "JSON Parsing Error: {}" , err) ; }
39+ }
3140 }
3241 } ;
3342}
You can’t perform that action at this time.
0 commit comments