File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,10 @@ internal async Task PrepareRequestAsync()
8383
8484 /// <summary>
8585 /// 执行请求
86+ /// 返回是否执行成功
8687 /// </summary>
8788 /// <returns></returns>
88- internal async Task ExecRequestAsync ( )
89+ internal async Task < bool > ExecRequestAsync ( )
8990 {
9091 try
9192 {
@@ -94,10 +95,12 @@ internal async Task ExecRequestAsync()
9495
9596 this . ResponseMessage = await client . SendAsync ( this . RequestMessage ) ;
9697 this . Result = await apiAction . Return . Attribute . GetTaskResult ( this ) ;
98+ return true ;
9799 }
98100 catch ( Exception ex )
99101 {
100102 this . Exception = ex ;
103+ return false ;
101104 }
102105 }
103106
Original file line number Diff line number Diff line change @@ -131,14 +131,11 @@ private async Task<TResult> RequestAsync()
131131
132132 await context . PrepareRequestAsync ( ) ;
133133 await context . ExecFiltersAsync ( filter => filter . OnBeginRequestAsync ) ;
134- await context . ExecRequestAsync ( ) ;
134+
135+ var state = await context . ExecRequestAsync ( ) ;
135136 await context . ExecFiltersAsync ( filter => filter . OnEndRequestAsync ) ;
136137
137- if ( context . Exception != null )
138- {
139- throw context . Exception ;
140- }
141- return ( TResult ) context . Result ;
138+ return state ? ( TResult ) context . Result : throw context . Exception ;
142139 }
143140 }
144141 }
You can’t perform that action at this time.
0 commit comments