Usage:
plugin.get(url).then(doStuff).catch(onError);
plugin.post(url, payload).then(doStuff).catch(onError);
onError will receive an error string, that is one of the following:
- error message from Gerrit REST API, eg. "Cherry pick failed: ..."
- error message from Fetch API, eg "TypeError: Failed to fetch"
- HTTP failure code, eg "404"
Bug: Issue 6595
Change-Id: I1a598fe2c249c8e87bc575359d51ad2e15431356