public static async void ExecuteRequestAsync(Func <Task> executeRequestDelegate, RestExceptionHandler restExceptionHandler) { try { await executeRequestDelegate.Invoke(); } catch (Exception ex) { if (ex is RestException && restExceptionHandler != null) { restExceptionHandler.Invoke((RestException)ex); } else { throw ex; } } }
public static void ExecuteRequest(Action executeRequestDelegate, RestExceptionHandler restExceptionHandler) { try { executeRequestDelegate.Invoke(); } catch (Exception ex) { if (ex is RestException && restExceptionHandler != null) { restExceptionHandler.Invoke((RestException)ex); } else { throw ex; } } }
public static async Task <T> ExecuteRequestAsync <T>(Func <Task <T> > executeRequestDelegate, RestExceptionHandler restExceptionHandler) where T : new() { T retVal = default(T); try { retVal = await executeRequestDelegate.Invoke(); } catch (Exception ex) { if (ex is RestException && restExceptionHandler != null) { restExceptionHandler.Invoke((RestException)ex); } else { throw ex; } } return(retVal); }