@@ -90,12 +90,22 @@ public extension Server {
9090 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing GET Request " )
9191 }
9292
93- try Task . checkCancellation ( )
93+ do {
94+ try Task . checkCancellation ( )
95+ } catch {
96+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
97+ throw error
98+ }
9499
95100 let request = try api. request ( . GET, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
96101 let decoded : T = try await self . sendRequest ( request, requestUID: requestUID, dateDecodingStrategy: dateDecodingStrategy, keyDecodingStrategy: keyDecodingStrategy)
97102
98- try Task . checkCancellation ( )
103+ do {
104+ try Task . checkCancellation ( )
105+ } catch {
106+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
107+ throw error
108+ }
99109
100110 return decoded
101111 }
@@ -113,12 +123,22 @@ public extension Server {
113123 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing POST Request " )
114124 }
115125
116- try Task . checkCancellation ( )
126+ do {
127+ try Task . checkCancellation ( )
128+ } catch {
129+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
130+ throw error
131+ }
117132
118133 let request = try api. request ( . POST, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
119134 let decoded : T = try await self . sendRequest ( request, requestUID: requestUID, dateDecodingStrategy: dateDecodingStrategy, keyDecodingStrategy: keyDecodingStrategy)
120135
121- try Task . checkCancellation ( )
136+ do {
137+ try Task . checkCancellation ( )
138+ } catch {
139+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
140+ throw error
141+ }
122142
123143 return decoded
124144 }
@@ -133,12 +153,22 @@ public extension Server {
133153 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing POST Request " )
134154 }
135155
136- try Task . checkCancellation ( )
156+ do {
157+ try Task . checkCancellation ( )
158+ } catch {
159+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
160+ throw error
161+ }
137162
138163 let request = try api. request ( . POST, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
139164 let wasSuccessful = try await self . sendRequest ( request, requestUID: requestUID)
140165
141- try Task . checkCancellation ( )
166+ do {
167+ try Task . checkCancellation ( )
168+ } catch {
169+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
170+ throw error
171+ }
142172
143173 return wasSuccessful
144174 }
@@ -157,12 +187,22 @@ public extension Server {
157187 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing PUT Request " )
158188 }
159189
160- try Task . checkCancellation ( )
190+ do {
191+ try Task . checkCancellation ( )
192+ } catch {
193+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
194+ throw error
195+ }
161196
162197 let request = try api. request ( . PUT, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
163198 let decoded : T = try await self . sendRequest ( request, requestUID: requestUID, dateDecodingStrategy: dateDecodingStrategy, keyDecodingStrategy: keyDecodingStrategy)
164199
165- try Task . checkCancellation ( )
200+ do {
201+ try Task . checkCancellation ( )
202+ } catch {
203+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
204+ throw error
205+ }
166206
167207 return decoded
168208 }
@@ -178,12 +218,22 @@ public extension Server {
178218 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing PUT Request " )
179219 }
180220
181- try Task . checkCancellation ( )
221+ do {
222+ try Task . checkCancellation ( )
223+ } catch {
224+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
225+ throw error
226+ }
182227
183228 let request = try api. request ( . PUT, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
184229 let wasSuccessful = try await self . sendRequest ( request, requestUID: requestUID)
185230
186- try Task . checkCancellation ( )
231+ do {
232+ try Task . checkCancellation ( )
233+ } catch {
234+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
235+ throw error
236+ }
187237
188238 return wasSuccessful
189239 }
@@ -201,12 +251,22 @@ public extension Server {
201251 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing DELETE Request " )
202252 }
203253
204- try Task . checkCancellation ( )
254+ do {
255+ try Task . checkCancellation ( )
256+ } catch {
257+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
258+ throw error
259+ }
205260
206261 let request = try api. request ( . DELETE, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
207262 let decoded : T = try await self . sendRequest ( request, requestUID: requestUID, dateDecodingStrategy: dateDecodingStrategy, keyDecodingStrategy: keyDecodingStrategy)
208263
209- try Task . checkCancellation ( )
264+ do {
265+ try Task . checkCancellation ( )
266+ } catch {
267+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
268+ throw error
269+ }
210270
211271 return decoded
212272 }
@@ -221,12 +281,22 @@ public extension Server {
221281 logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Processing DELETE Request " )
222282 }
223283
224- try Task . checkCancellation ( )
284+ do {
285+ try Task . checkCancellation ( )
286+ } catch {
287+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: api. path) ) [Cancelled] " )
288+ throw error
289+ }
225290
226291 let request = try api. request ( . DELETE, in: self . currentEnvironment, additionalHeaders: self . additionalHTTPHeaders, additionalQueries: queries, httpBodyOverride: httpBody, timeoutInterval: timeoutInterval)
227292 let wasSuccessful = try await self . sendRequest ( request, requestUID: requestUID)
228293
229- try Task . checkCancellation ( )
294+ do {
295+ try Task . checkCancellation ( )
296+ } catch {
297+ self . logger. info ( " \( Date ( ) ) - ( \( requestUID) ) Request to \( String ( describing: request. url? . description) ) [Cancelled] " )
298+ throw error
299+ }
230300
231301 return wasSuccessful
232302 }
0 commit comments