@@ -12,12 +12,14 @@ use anyhow::Result;
12
12
use async_requests:: types:: AsynchronousRequestResult ;
13
13
use async_requests:: types:: RowId ;
14
14
use async_requests:: types:: ThriftAsynchronousRequestParams ;
15
+ use async_requests:: types:: ThriftAsynchronousRequestResult ;
15
16
use async_requests:: AsyncMethodRequestQueue ;
16
17
use clap:: Args ;
17
18
use context:: CoreContext ;
18
19
use megarepo_error:: MegarepoError ;
19
20
use mononoke_api:: MononokeRepo ;
20
21
use source_control as thrift;
22
+ use source_control:: AsyncRequestError ;
21
23
22
24
#[ derive( Args ) ]
23
25
/// Changes the request status to ready and put error as result.
@@ -41,24 +43,42 @@ pub async fn abort_request(
41
43
. context ( "retrieving the request" ) ?
42
44
{
43
45
if maybe_result. is_none ( ) {
44
- let err = MegarepoError :: InternalError ( anyhow ! ( "aborted from CLI!" ) . into ( ) ) ;
46
+ let megarepo_err = MegarepoError :: InternalError ( anyhow ! ( "aborted from CLI!" ) . into ( ) ) ;
47
+ let default_err =
48
+ AsynchronousRequestResult :: from_thrift ( ThriftAsynchronousRequestResult :: error (
49
+ AsyncRequestError :: internal_error ( thrift:: InternalErrorStruct {
50
+ reason : String :: from ( "aborted from CLI!" ) ,
51
+ backtrace : None ,
52
+ source_chain : vec ! [ ] ,
53
+ ..Default :: default ( )
54
+ } ) ,
55
+ ) ) ;
45
56
let result: AsynchronousRequestResult = match params. thrift ( ) {
46
57
ThriftAsynchronousRequestParams :: megarepo_sync_changeset_params( _) => {
47
- thrift:: MegarepoSyncChangesetResult :: error ( err . into ( ) ) . into ( )
58
+ thrift:: MegarepoSyncChangesetResult :: error ( megarepo_err . into ( ) ) . into ( )
48
59
}
49
60
ThriftAsynchronousRequestParams :: megarepo_add_target_params( _) => {
50
- thrift:: MegarepoAddTargetResult :: error ( err . into ( ) ) . into ( )
61
+ thrift:: MegarepoAddTargetResult :: error ( megarepo_err . into ( ) ) . into ( )
51
62
}
52
63
ThriftAsynchronousRequestParams :: megarepo_change_target_params( _) => {
53
- thrift:: MegarepoChangeTargetConfigResult :: error ( err . into ( ) ) . into ( )
64
+ thrift:: MegarepoChangeTargetConfigResult :: error ( megarepo_err . into ( ) ) . into ( )
54
65
}
55
66
ThriftAsynchronousRequestParams :: megarepo_remerge_source_params( _) => {
56
- thrift:: MegarepoRemergeSourceResult :: error ( err . into ( ) ) . into ( )
67
+ thrift:: MegarepoRemergeSourceResult :: error ( megarepo_err . into ( ) ) . into ( )
57
68
}
58
69
ThriftAsynchronousRequestParams :: megarepo_add_branching_target_params( _) => {
59
- thrift:: MegarepoAddBranchingTargetResult :: error ( err. into ( ) ) . into ( )
70
+ thrift:: MegarepoAddBranchingTargetResult :: error ( megarepo_err. into ( ) ) . into ( )
71
+ }
72
+ ThriftAsynchronousRequestParams :: commit_sparse_profile_size_params( _) => {
73
+ default_err
74
+ }
75
+ ThriftAsynchronousRequestParams :: commit_sparse_profile_delta_params( _) => {
76
+ default_err
77
+ }
78
+ ThriftAsynchronousRequestParams :: async_ping_params( _) => default_err,
79
+ ThriftAsynchronousRequestParams :: UnknownField ( _) => {
80
+ return Err ( anyhow ! ( "unknown request type!" ) ) ;
60
81
}
61
- _ => return Err ( anyhow ! ( "unknown request type!" ) ) ,
62
82
} ;
63
83
queue
64
84
. complete ( & ctx, & request_id, result)
0 commit comments