Added basic exception handling to rest client