more detailed error logging for google docs linking issue

In some cases, google docs api is returning an xml document that our
api doesn't know how to handle. More info is needed in order to assess
and fix the issue.

Refs CNVS-3012

Change-Id: Ia78047872e054204cc32d2b5ae42adc830b80942
Reviewed-on: https://gerrit.instructure.com/16996
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Duane Johnson 2013-01-21 11:53:13 -07:00 committed by Brian Palmer
parent f519ae1fae
commit 22e3992dd3
1 changed files with 13 additions and 2 deletions

View File

@ -223,8 +223,19 @@ module GoogleDocs
category.label = "document"
end
end
response = access_token.post(url, entry.to_xml, {'Content-Type' => 'application/atom+xml'})
entry = GoogleDocEntry.new(Atom::Entry.load_entry(response.body))
xml = entry.to_xml
begin
response = access_token.post(url, xml, {'Content-Type' => 'application/atom+xml'})
rescue => e
raise "Unable to post to Google API #{url}:\n#{xml}" +
"\n\n(" + e.to_s + ")\n"
end
begin
entry = GoogleDocEntry.new(Atom::Entry.load_entry(response.body))
rescue => e
raise "Unable to load GoogleDocEntry from response: \n" + response.body +
"\n\n(" + e.to_s + ")\n"
end
end
def google_docs_delete_doc(entry, access_token = google_docs_retrieve_access_token)