public ReverseWordsResponse ReverseWords(ReverseWordsRequest request) { if (request == null) { throw new FaultException <ArgumentNullException>(new ArgumentNullException("request"), "null arguments are invalid"); } try { var result = new ReverseWordsResponse(ReverseWordsManager.Reverse(request.s)); return(result); } catch (ArgumentNullException exp) { throw new FaultException <ArgumentNullException>(exp, exp.Message); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public async Task <ReverseWordsResponse> ReverseWordsAsync(ReverseWordsRequest request) { if (request == null) { throw new FaultException <ArgumentNullException>(new ArgumentNullException("request"), "null arguments are invalid"); } return(await Task.Run <ReverseWordsResponse>(() => { try { var result = new ReverseWordsResponse(ReverseWordsManager.Reverse(request.s)); return result; } catch (ArgumentNullException exp) { throw new FaultException <ArgumentNullException>(exp, exp.Message); } catch (Exception ex) { throw new FaultException(ex.Message); } } )); }