Files
gerrit/polygerrit-ui/app/elements/shared/gr-js-api-interface
David Ostrovsky a4ac1abec0 PolyGerrit: Expose error function in plugin rest API
If user optionally pass error handling function to the send method of
rest API, request error can be processed in custom elements, e.g.:

  const errFn = response => {
    this.fire('page-error', {response});
  };
  return this.plugin.restApi().send(method, endpoint, body, errFn)
      .then(r => {
          Gerrit.Nav.navigateToRelativeUrl('/admin/repos');
      });

Considered alternative is to handle errors in plugin requests by
providing generic function that does the same: fire page-error event,
but having a way to provide custom error function is more flexible
approach.

Change-Id: Idd7e86dd0c40d53f4327c013fa0bb469ee8a6fff
2018-08-29 21:07:21 +02:00
..