Improved error handling

This PR provides additional error handling including providing the status or the request.