adding better error logging to api request methods