public async Task GetUserById(int id, Action <UserDto> executeSuccess = null, Action <string, Exception> executeError = null) { try { var result = await InvokeServiceCheckInternetConnection(async() => { var response = await JongSnamServices.GetUserByIdWithHttpMessagesAsync(id, CustomHeaders); return(await GetRespondDtoHandlerHttpStatus <UserDto>(response)); }); executeSuccess?.Invoke(result); } catch (InvalidAccessTokenException ex) { executeError?.Invoke(ex.Message, ex); } catch (BadRequestException ex) { executeError?.Invoke(MessageConstants.SomeValueINvalid + "\n[" + ex.Message + "]", ex); } catch (UnauthorizedException uex) { executeError?.Invoke(MessageConstants.UnauthorizedError, uex); } catch (InternalServerErrorException inex) { executeError?.Invoke(MessageConstants.SomethingWentWrong, inex); } catch (NoInternetConnectionException nicex) { executeError?.Invoke(MessageConstants.CannotConnectToInternet, nicex); } catch (Exception ex) { executeError?.Invoke(MessageConstants.SomethingWentWrong, ex); } }