File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 15
15
# You should have received a copy of the GNU Lesser General Public License
16
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
18
+ import asyncio
18
19
import functools
19
20
20
21
@@ -262,11 +263,22 @@ def on_http_error(error):
262
263
263
264
def wrap (f ):
264
265
@functools .wraps (f )
265
- async def wrapped_f (* args , ** kwargs ):
266
+ def wrapped_f (* args , ** kwargs ):
266
267
try :
267
- return await f (* args , ** kwargs )
268
+ result = f (* args , ** kwargs )
268
269
except GitlabHttpError as e :
269
270
raise error (e .error_message , e .response_code , e .response_body )
271
+ else :
272
+ if not asyncio .iscoroutine (result ):
273
+ return result
274
+
275
+ async def awaiter ():
276
+ try :
277
+ await result
278
+ except GitlabHttpError as e :
279
+ raise error (e .error_message , e .response_code , e .response_body )
280
+
281
+ return awaiter
270
282
271
283
return wrapped_f
272
284
You can’t perform that action at this time.
0 commit comments