1- use  http:: { Method ,  Response ,  uri :: InvalidUri } ; 
1+ use  http:: { Method ,  Response } ; 
22use  http_body_util:: { BodyExt ,  Full ,  combinators:: BoxBody } ; 
33use  hyper:: body:: Bytes ; 
44use  hyper_util:: client:: legacy:: Error  as  HyperUtilError ; 
55use  std:: { 
66    error:: Error , 
77    fmt:: { Display ,  Formatter ,  Result  as  FmtResult } , 
88} ; 
9- use  twilight_http_ratelimiting:: request:: PathParseError ; 
109
11- static  ACQUIRING_TICKET_FAILED_MSG :  & str  =
12-     "http-proxy: Acquiring ticket from the ratelimiter failed" ; 
13- static  INVALID_URI_MSG :  & str  = "http-proxy: Failed to create URI for requesting Discord API" ; 
1410static  INVALID_METHOD_MSG :  & str  = "http-proxy: Unsupported HTTP method in request" ; 
15- static  INVALID_PATH_MSG :  & str  = "http-proxy: Failed to parse API path from client request" ; 
1611static  REQUEST_ISSUE_MSG :  & str  = "http-proxy: Error requesting the Discord API" ; 
1712
1813#[ allow( clippy:: module_name_repetitions) ]  
1914#[ derive( Debug ) ]  
2015pub  enum  RequestError  { 
21-     AcquiringTicket  { 
22-         source :  Box < dyn  Error  + Send  + Sync > , 
23-     } , 
24-     InvalidMethod  { 
25-         method :  Method , 
26-     } , 
27-     InvalidPath  { 
28-         source :  PathParseError , 
29-     } , 
30-     InvalidURI  { 
31-         source :  InvalidUri , 
32-     } , 
33-     RequestIssue  { 
34-         source :  HyperUtilError , 
35-     } , 
16+     InvalidMethod  {  method :  Method  } , 
17+     RequestIssue  {  source :  HyperUtilError  } , 
3618} 
3719
3820impl  RequestError  { 
3921    pub  fn  as_response ( & self )  -> Response < BoxBody < Bytes ,  hyper:: Error > >  { 
4022        let  ( status_code,  body_incoming)  = match  self  { 
41-             RequestError :: AcquiringTicket  {  .. }  => ( 500 ,  ACQUIRING_TICKET_FAILED_MSG ) , 
42-             RequestError :: InvalidURI  {  .. }  => ( 500 ,  INVALID_URI_MSG ) , 
4323            RequestError :: InvalidMethod  {  .. }  => ( 501 ,  INVALID_METHOD_MSG ) , 
44-             RequestError :: InvalidPath  {  .. }  => ( 501 ,  INVALID_PATH_MSG ) , 
4524            RequestError :: RequestIssue  {  .. }  => ( 502 ,  REQUEST_ISSUE_MSG ) , 
4625        } ; 
4726
@@ -57,22 +36,10 @@ impl RequestError {
5736impl  Display  for  RequestError  { 
5837    fn  fmt ( & self ,  f :  & mut  Formatter < ' _ > )  -> FmtResult  { 
5938        match  self  { 
60-             Self :: AcquiringTicket  {  source }  => { 
61-                 f. write_str ( "error when acquiring ratelimiting ticket: " ) ?; 
62-                 source. fmt ( f) 
63-             } 
6439            Self :: InvalidMethod  {  method }  => { 
6540                f. write_str ( "invalid method: " ) ?; 
6641                method. fmt ( f) 
6742            } 
68-             Self :: InvalidPath  {  source }  => { 
69-                 f. write_str ( "invalid path: " ) ?; 
70-                 source. fmt ( f) 
71-             } 
72-             Self :: InvalidURI  {  source }  => { 
73-                 f. write_str ( "generated uri for discord api is invalid: " ) ?; 
74-                 source. fmt ( f) 
75-             } 
7643            Self :: RequestIssue  {  source }  => { 
7744                f. write_str ( "error executing request: " ) ?; 
7845                source. fmt ( f) 
0 commit comments