Return error code when calling get, post, put, patch, and delete methods