added exception handling for web api