Guest User

Untitled

a guest
Sep 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. exception handling for servicemodel exceptions
  2. try{ call to service }
  3. catch(CommunicationObjectFaultedException){}
  4. catch (EndpointNotFoundException){}
  5.  
  6. public static bool TryExecute(Action a) {
  7. try {
  8. a();
  9. return true;
  10. }
  11. catch (CommunicationObjectFaultedException) { }
  12. catch (EndpointNotFoundException) { }
  13. return false;
  14. }
  15.  
  16. bool ok = TryExecute(() => {
  17. // call to service
  18. //...
  19. });
Add Comment
Please, Sign In to add comment