@@ -22,13 +22,13 @@ pub async fn handle_error(
22
22
opt_udp_server_stats_event_sender : & crate :: event:: sender:: Sender ,
23
23
cookie_valid_range : Range < f64 > ,
24
24
error : & Error ,
25
- transaction_id : Option < TransactionId > ,
25
+ opt_transaction_id : Option < TransactionId > ,
26
26
) -> Response {
27
27
tracing:: trace!( "handle error" ) ;
28
28
29
29
let server_socket_addr = server_service_binding. bind_address ( ) ;
30
30
31
- match transaction_id {
31
+ match opt_transaction_id {
32
32
Some ( transaction_id) => {
33
33
let transaction_id = transaction_id. 0 . to_string ( ) ;
34
34
tracing:: error!( target: UDP_TRACKER_LOG_TARGET , error = %error, %client_socket_addr, %server_socket_addr, %request_id, %transaction_id, "response error" ) ;
@@ -38,13 +38,7 @@ pub async fn handle_error(
38
38
}
39
39
}
40
40
41
- let e = if let Error :: RequestParseError { request_parse_error } = error {
42
- ( request_parse_error. message . clone ( ) , transaction_id)
43
- } else {
44
- ( error. to_string ( ) , transaction_id)
45
- } ;
46
-
47
- if e. 1 . is_some ( ) {
41
+ if opt_transaction_id. is_some ( ) {
48
42
// code-review: why we trigger an event only if transaction_id is present?
49
43
50
44
if let Some ( udp_server_stats_event_sender) = opt_udp_server_stats_event_sender. as_deref ( ) {
@@ -59,7 +53,7 @@ pub async fn handle_error(
59
53
}
60
54
61
55
Response :: from ( ErrorResponse {
62
- transaction_id : e . 1 . unwrap_or ( TransactionId ( I32 :: new ( 0 ) ) ) ,
63
- message : e . 0 . into ( ) ,
56
+ transaction_id : opt_transaction_id . unwrap_or ( TransactionId ( I32 :: new ( 0 ) ) ) ,
57
+ message : error . to_string ( ) . into ( ) ,
64
58
} )
65
59
}
0 commit comments