Added generic exception handling to api request